mirror of
https://github.com/farcasclaudiu/terraform-course.git
synced 2026-06-22 07:01:56 +03:00
for and foreach demo
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
provider "aws" {
|
||||
region = var.AWS_REGION
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
variable "AWS_REGION" {
|
||||
type = string
|
||||
default = "eu-west-1"
|
||||
}
|
||||
Reference in New Issue
Block a user