At the heart of what I’m trying to do… I’m trying to set the map_public_ip_on_launch
value to true
if the map key equals public
. Thoughts?
variables.tf
variable "az1_subnets" {
type = map
default = {
public = "10.10.10.0/24"
private = "10.10.11.0/24"
}
}
main.tf
...
resource "aws_subnet" "az1" {
for_each = var.az1_subnets
...
map_public_ip_on_launch = {each.key = "public" ? 1 : 0}
...
}
It’s quite possible I’m being stupid… Please call me out on it as I’m still learning all of this stuff.