Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't splat over a resource's list attribute #2833

Closed
thegedge opened this issue Jul 23, 2015 · 4 comments
Closed

Can't splat over a resource's list attribute #2833

thegedge opened this issue Jul 23, 2015 · 4 comments

Comments

@thegedge
Copy link
Contributor

The best example is for elasticache:

resource "aws_elasticache_cluster" "memcache" {
   …
}

output "cache_nodes" {
  value = "${join(",', aws_elasticache_cluster.memcache.cache_nodes.*.address)}"
}

When testing locally with our own stacks, cache_nodes isn't even an output when I do the above. For now we've simply restricted the cluster size to 1 and access the cache_node directly.

@maxrothman
Copy link

Any movement on being able to splat over list attributes?

@apparentlymart
Copy link
Contributor

This will be supported in the next major version of Terraform, as described in the Generalized Splat Expressions article.

@apparentlymart
Copy link
Contributor

In Terraform v0.12-alpha1 we can see the new "generalized splat" behavior working for all list values:

locals {
  example = [
    {
      id = "foo"
    },
    {
      id = "bar"
    },
    {
      id = "baz"
    },
  ]
}

output "example" {
  value = local.example.*.id
}
$ terraform output
example = [
  "foo",
  "bar",
  "baz",
]

Although the above uses a local value list for simplicity, the splat expression syntax can now be applied to any list value, regardless of where it is obtained from.

@apparentlymart apparentlymart added this to the v0.12.0 milestone Oct 29, 2018
@ghost
Copy link

ghost commented Mar 31, 2020

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.

@ghost ghost locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants