Last active
May 18, 2016 03:30
-
-
Save kamatama41/c9e32a3c2033c21f3e2a059c3b6c8422 to your computer and use it in GitHub Desktop.
I'd like to do the following foreach syntax at Terraform to reduce code amount...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
["http", "https"].each do |protocol| | |
resource "aws_security_group_rule" "allow_${protocol}" { | |
security_group_id = "${aws_security_group.foo.id}" | |
type = "ingress" | |
from_port = ${protocol == "http" ? 80 : 443} | |
to_port = ${protocol == "http" ? 80 : 443} | |
protocol = "${protocol}" | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment