Skip to content

Commit

Permalink
fix typo (#3)
Browse files Browse the repository at this point in the history
* fix typo in variable block

* fix booleans in count

* fix listener_arns output

* excplicitly add types to variables
  • Loading branch information
sarkis committed Jun 15, 2018
1 parent f048ef0 commit 7c67cc9
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
17 changes: 8 additions & 9 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ module "default_label" {

resource "aws_security_group" "default" {
description = "Controls access to the ALB (HTTP/HTTPS)"

vpc_id = "${var.vpc_id}"
name = "${module.default_label.id}"
tags = "${module.default_label.tags}"
vpc_id = "${var.vpc_id}"
name = "${module.default_label.id}"
tags = "${module.default_label.tags}"
}

resource "aws_security_group_rule" "egress" {
Expand All @@ -26,7 +25,7 @@ resource "aws_security_group_rule" "egress" {
}

resource "aws_security_group_rule" "http_ingress" {
count = "${var.http_enabled}"
count = "${var.http_enabled == "true" ? 1 : 0}"
type = "ingress"
from_port = "${var.http_port}"
to_port = "${var.http_port}"
Expand All @@ -37,7 +36,7 @@ resource "aws_security_group_rule" "http_ingress" {
}

resource "aws_security_group_rule" "https_ingress" {
count = "${var.https_enabled}"
count = "${var.https_enabled == "true" ? 1 : 0}"
type = "ingress"
from_port = "${var.https_port}"
to_port = "${var.https_port}"
Expand All @@ -48,7 +47,7 @@ resource "aws_security_group_rule" "https_ingress" {
}

module "access_logs" {
source = "git::https://github.com/cloudposse/terraform-aws-lb-s3-bucket.git?ref=init"
source = "git::https://github.com/cloudposse/terraform-aws-lb-s3-bucket.git?ref=tags/0.1.0"
attributes = "${var.attributes}"
delimiter = "${var.delimiter}"
name = "${var.name}"
Expand Down Expand Up @@ -111,7 +110,7 @@ resource "aws_lb_target_group" "default" {
}

resource "aws_lb_listener" "http" {
count = "${var.http_enabled}"
count = "${var.http_enabled == "true" ? 1 : 0}"
load_balancer_arn = "${aws_lb.default.arn}"
port = "${var.http_port}"
protocol = "HTTP"
Expand All @@ -123,7 +122,7 @@ resource "aws_lb_listener" "http" {
}

resource "aws_lb_listener" "https" {
count = "${var.https_enabled}"
count = "${var.https_enabled == "true" ? 1 : 0}"
load_balancer_arn = "${aws_lb.default.arn}"

port = "${var.https_port}"
Expand Down
2 changes: 1 addition & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ output "https_listener_arn" {

output "listener_arns" {
description = "A list of all the listener ARNs"
value = ["${aws_lb_listener.http.arn}"]
value = ["${compact(concat(aws_lb_listener.http.*.arn, aws_lb_listener.https.*.arn))}"]
}

output "access_logs_bucket_id" {
Expand Down
28 changes: 26 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
variable "namespace" {
type = "string"
description = "Namespace, which could be your organization name, e.g. `cp` or `cloudposse`"
}

variable "stage" {
type = "string"
description = "Stage, e.g. `prod`, `staging`, `dev`, or `test`"
}

variable "name" {
type = "string"
description = "Solution name, e.g. `app`"
}

Expand Down Expand Up @@ -34,8 +37,8 @@ variable "vpc_id" {
}

variable "subnet_ids" {
type = "list"
desciption = "A list of subnet IDs to associate with ALB"
type = "list"
description = "A list of subnet IDs to associate with ALB"
}

variable "security_group_ids" {
Expand All @@ -45,16 +48,19 @@ variable "security_group_ids" {
}

variable "internal" {
type = "string"
default = "false"
description = "A boolean flag to determine whether the ALB should be internal"
}

variable "http_port" {
type = "string"
default = "80"
description = "The port for the HTTP listener"
}

variable "http_enabled" {
type = "string"
default = "true"
description = "A boolean flag to enable/disable HTTP listener"
}
Expand All @@ -72,16 +78,19 @@ variable "http_ingress_prefix_list_ids" {
}

variable "certificate_arn" {
type = "string"
default = ""
description = "The ARN of the default SSL certificate for HTTPS listener"
}

variable "https_port" {
type = "string"
default = "443"
description = "The port for the HTTPS listener"
}

variable "https_enabled" {
type = "string"
default = "false"
description = "A boolean flag to enable/disable HTTPS listener"
}
Expand All @@ -99,76 +108,91 @@ variable "https_ingress_prefix_list_ids" {
}

variable "access_logs_prefix" {
type = "string"
default = ""
description = "The S3 bucket prefix"
}

variable "access_logs_enabled" {
type = "string"
default = "true"
description = "A boolean flag to enable/disable access_logs"
}

variable "access_logs_region" {
type = "string"
default = "us-east-1"
description = "The region for the access_logs S3 bucket"
}

variable "cross_zone_load_balancing_enabled" {
type = "string"
default = "true"
description = "A boolean flag to enable/disable cross zone load balancing"
}

variable "http2_enabled" {
type = "string"
default = "true"
description = "A boolean flag to enable/disable HTTP/2"
}

variable "idle_timeout" {
type = "string"
default = "60"
description = "The time in seconds that the connection is allowed to be idle"
}

variable "ip_address_type" {
type = "string"
default = "ipv4"
description = "The type of IP addresses used by the subnets for your load balancer. The possible values are `ipv4` and `dualstack`."
}

variable "deletion_protection_enabled" {
type = "string"
default = "false"
description = "A boolean flag to enable/disable deletion protection for ALB"
}

variable "deregistration_delay" {
type = "string"
default = "15"
description = "The amount of time to wait in seconds before changing the state of a deregistering target to unused"
}

variable "health_check_path" {
type = "string"
default = "/"
description = "The destination for the health check request"
}

variable "health_check_timeout" {
type = "string"
default = "10"
description = "The amount of time to wait in seconds before failing a health check request"
}

variable "health_check_healthy_threshold" {
type = "string"
default = "2"
description = "The number of consecutive health checks successes required before considering an unhealthy target healthy"
}

variable "health_check_unhealthy_threshold" {
type = "string"
default = "2"
description = "The number of consecutive health check failures required before considering the target unhealthy"
}

variable "health_check_interval" {
type = "string"
default = "15"
description = "The duration in seconds in between health checks"
}

variable "health_check_matcher" {
type = "string"
default = "200-399"
description = "The HTTP response codes to indicate a healthy check"
}

0 comments on commit 7c67cc9

Please sign in to comment.