Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix typo #3

Merged
merged 5 commits into from
Jun 15, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix booleans in count
  • Loading branch information
sarkis committed Jun 15, 2018
commit 71607c6c74bd6d816eb73fc5cce346753cac2ea4
8 changes: 4 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ resource "aws_security_group_rule" "egress" {
}

resource "aws_security_group_rule" "http_ingress" {
count = "${var.http_enabled}"
count = "${var.http_enabled ? 1 : 0}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use explicit comparison: var.http_enabled == "true"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure http_enabled is a string. boolean variables in TF are not recommended by terraform.

type = "ingress"
from_port = "${var.http_port}"
to_port = "${var.http_port}"
Expand All @@ -37,7 +37,7 @@ resource "aws_security_group_rule" "http_ingress" {
}

resource "aws_security_group_rule" "https_ingress" {
count = "${var.https_enabled}"
count = "${var.https_enabled ? 1 : 0}"
type = "ingress"
from_port = "${var.https_port}"
to_port = "${var.https_port}"
Expand Down Expand Up @@ -111,7 +111,7 @@ resource "aws_lb_target_group" "default" {
}

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

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

port = "${var.https_port}"
Expand Down