Okay, I realize I'm probably mis-using outputs, but I've just stumbled onto this: Using this workaround with nested maps which themselves have values which are lists, causes the output to be dropped out of existence entirely! Applying the above, you can verify that Terraform map nesting is now quite powerful and this makes a lot of things easier. A normal route ta Using other features of the Hashicorp Configuration Language (HCL), which Terraform uses, resource information can be queried and transformed into more complex data structures, such as lists and maps. ... be used to output certain values to the CLI during a terraform apply or to provide inputs to other resources created by Terraform. An example where I used this recently was in a Terraform module for creating a pod of EC2 Instances: module "omni_lab_alpha" {source = "./modules/omni_box" lab_name = "primary" ami = "${var.ami}" instance_type = "${var.instance_type}" node_count = "${var.node_count}" public_key_path = ⦠Using this, I can now do stuff like: output "image_bucket_name" { value = "${lookup(var.image_bucket_names, var.environment, "No way this should happen")}" } where: Resources: 0 added, 0 changed, 0 destroyed. It is going to contain 1 or more routes, but those are dependent upon the implementation; one may have 1 or 2, another may have more or even zero. Looking at the source for config_map_aws_auth output it just directly returns the state of the kubernetes_config_map.If you have manage_aws_auth = false set on the module then the output will be an empty tuple.. How to define output values for dynamically created terraform resources Published: 16 August 2020 1 minute read Looking at the standard documentation page for terraform output there are some samples for basic values and for how to access module values.. Introduction. author 18 Sep 2019 on terraform | terraform expressions | terraform functions | terraform for | terraform for_each | terraform zip_map | terraform output Building Dynamic Outputs with Terraform Expressions and Functions. Dropping a quick reference here on some specific use cases for Terraform syntax. In the same folder launch terraform console for testing built-in functions. Nested Loops in Terraform: Create a map from 2 lists By Yüriy , March 7, 2020 7:42 pm Recently I encountered a Terraform task in which I had a list of roles and a list of policies and I needed to create a AWS resource for every combination of role-policy. Output values are declared using an output block. If manage_aws_auth is true then the output would be slightly more useful but the module will already be trying to ⦠Maps can be used to select specific values based on a user defined key. You may need to terraform init if you haven't already. terraform console Inside the console type: zipmap([for m in local.shared_env: m.name], [for m in local.shared_env: m.value]) Observe the output of each list-item-map being a name-value-pair of a single map: Scenario #1 I want to build an Azure Route Table. This is great, but what if you had been following some of my previous posts about looping and want get some output ⦠Terraformâs for expressions also allow you to loop over a map using the following syntax: [for
, in