mirror of
https://github.com/farcasclaudiu/terraform-course.git
synced 2026-06-28 21:01:57 +03:00
for and foreach demo
This commit is contained in:
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user