for and foreach demo

This commit is contained in:
Edward Viaene
2019-10-30 16:05:22 +01:00
parent 5d9eeb6c4c
commit a83f7669ab
10 changed files with 89 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
provider "aws" {
region = var.AWS_REGION
}
+12
View File
@@ -0,0 +1,12 @@
resource "aws_security_group" "example" {
name = "example" # can use expressions here
dynamic "ingress" {
for_each = [22, 443]
content {
from_port = ingress.value
to_port = ingress.value
protocol = "tcp"
}
}
}
+4
View File
@@ -0,0 +1,4 @@
variable "AWS_REGION" {
type = string
default = "eu-west-1"
}