-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Splat doesn't work properly #672
Comments
Using version 0.10.0
Error applying plan:
Checking the
Output should return a list of node IDs, however it returns a string with the number for nodes in cluster:
If remove the splat
returns a list with all the node info as it should.
It seems like splat The workaround is to manually create each resource and reference the nodes individually (in this case CloudWatch alarm). |
Hi folks 👋 This issue is resolved in Terraform 0.12, which fully supports indexed splat ( Given this configuration: terraform {
required_providers {
aws = "2.20.0"
}
required_version = "0.12.5"
}
provider "aws" {
region = "us-east-2"
}
resource "aws_elasticache_cluster" "test" {
cluster_id = "bflad-testing"
engine = "memcached"
node_type = "cache.t2.micro"
num_cache_nodes = 3
}
output "test1" {
value = aws_elasticache_cluster.test.cache_nodes[*].address
}
output "test2" {
value = element(aws_elasticache_cluster.test.cache_nodes[*].address, 1)
}
output "test3" {
value = join(",", formatlist("%s:%s", aws_elasticache_cluster.test.cache_nodes[*].address, aws_elasticache_cluster.test.cache_nodes[*].port))
} We can get the various expected outputs that were problematic in Terraform 0.11 and earlier:
Enjoy! 🚀 |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
This issue was originally opened by @slikk66 as hashicorp/terraform#13397. It was migrated here as part of the provider split. The original body of the issue is below.
Hi there,
Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.
Terraform Version
terraform -v
Terraform v0.9.2
Affected Resource(s)
Please list the resources as a list, for example:
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this. (think it does)
Expected Behavior
create output of multiple cache nodes using splat:
Try to read in these addresses for DNS:
Actual Behavior
However, if you define the outputs using hardcoded indexes, it works:
The text was updated successfully, but these errors were encountered: