Terraform: outputting maps not working

Created on 22 Aug 2016  ยท  4Comments  ยท  Source: hashicorp/terraform

Terraform Version

0.7.0

Affected Resource(s)

Please list the resources as a list, for example:

  • output

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

output "test_map" {
    value = {
        foo = "bar"
    }
}

Debug Output

https://gist.github.com/rbuels/2832e49a256199f857037fda3a2b58ed

Expected Behavior

Terraform plan should at least have run without error

Actual Behavior

Terraform plan emitted the error: output test_map is not a valid type ([]map[string]interface {})'

Steps to Reproduce

  1. Make a file with a map output, as shown above.
  2. Run terraform plan on it.

    References

Wasn't support for this supposed to be added by #5841?
https://github.com/hashicorp/terraform/pull/5841

bug core

Most helpful comment

Also seeing this problem. What is the correct syntax/formatting for this?

All 4 comments

Also seeing this problem. What is the correct syntax/formatting for this?

After digging around some more, I figured out how to create maps in output. You have to use the map function. See here

output "test-map" { 
  value = "${map(
    "test-value-1", "map-value-1"
    "test-value-2", "map-value-2"
  )}"
}

However, terraform still does not support nested maps. #2114

Closed via #9268

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings