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
+13
View File
@@ -0,0 +1,13 @@
resource "aws_security_group" "example" {
name = "example" # can use expressions here
dynamic "ingress" {
for_each = var.ports
content {
from_port = ingress.key
to_port = ingress.key
cidr_blocks = ingress.value
protocol = "tcp"
}
}
}