Created
August 11, 2021 01:10
-
-
Save arehmandev/9ceb41b529eb28fb565cab28a6d6dd70 to your computer and use it in GitHub Desktop.
example of tf map manipulation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
locals { | |
virtual_machines = { | |
"test-services1" = { | |
vm_instance_group = "instance-group-services" | |
}, | |
"test-services2" = { | |
vm_instance_group = "instance-group-services" | |
}, | |
"test-cpu" = { | |
vm_instance_group = null | |
}, | |
"test-mdf" = { | |
vm_instance_group = null | |
}, | |
"bastion" = { | |
vm_instance_group = null | |
} | |
"test-jupyter" = { | |
vm_instance_group = "instance-group-jupyter" | |
}, | |
"test-sbox" = { | |
vm_instance_group = "instance-group-sbox" | |
} | |
} | |
test = { for k, v in local.virtual_machines : | |
v.vm_instance_group => k... | |
if v.vm_instance_group != null } | |
test2 = { for k, v in local.test : | |
k => { "servers" : v } } | |
} | |
output "test2" { | |
value = local.test2 | |
} | |
# Apply complete! Resources: 0 added, 0 changed, 0 destroyed. | |
# Outputs: | |
# test2 = { | |
# "instance-group-jupyter" = { | |
# "servers" = [ | |
# "test-jupyter", | |
# ] | |
# } | |
# "instance-group-sbox" = { | |
# "servers" = [ | |
# "test-sbox", | |
# ] | |
# } | |
# "instance-group-services" = { | |
# "servers" = [ | |
# "test-services1", | |
# "test-services2", | |
# ] | |
# } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment