You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The output value should be lazy evaluated correctly and return either an empty string or the elasticache address depending on if the resource was created. This is a known and well documented hack people are recommending until v0.12 is released which will allow ternary expressions to evaluate correctly with potentially missing resources. This behaviour does work as expected with other resources such as EC2 ip addresses and RDS SQL endpoints.
Actual Behavior
Error: Error running plan: 1 error(s) occurred:
* module.redis.output.redis_endpoint: Resource 'aws_elasticache_cluster.redis' does not have attribute 'cache_nodes.0.address' for variable 'aws_elasticache_cluster.redis.*.cache_nodes.0.address'
Steps to Reproduce
Running terraform apply when the install_redis variable is set to true returns the error.
Running terraform apply when the install_redis variable is set to false returns the correct behaviour of an empty string outputted.
Commenting out the output block, running 'terraform apply', then adding the output back, running 'terraform apply' a second time correctly returns the elasticache endpoint address.
* module.redis.output.redis_endpoint: Resource 'aws_elasticache_cluster.redis' does not have attribute 'cache_nodes.*.address' for variable 'aws_elasticache_cluster.redis.*.cache_nodes.*.address'
It appears the evaluation of the expression differs depending on if terraform knows the resource will be created or not and the evaluation appears to work differently due to the nested lists. Are there alternative recommended approaches/hacks to conditionally output the elasticache endpoint address ?
The text was updated successfully, but these errors were encountered:
This issue relates to an older version of Terraform that is no longer in active development, and because the area of Terraform it relates to has changed significantly since the issue was opened we suspect that the issue is either fixed or that the circumstances around it have changed enough that we'd need an updated issue report in order to reproduce and address it.
If you're still seeing this or a similar issue in the latest version of Terraform, please do feel free to open a new bug report! Please be sure to include all of the information requested in the template, even if it might seem redundant with the information already shared in this issue, because the internal details relating to this problem are likely to be different in the current version of Terraform.
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
locked and limited conversation to collaborators
Sep 27, 2019
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Terraform Version
Terraform Configuration Files
Expected Behavior
The output value should be lazy evaluated correctly and return either an empty string or the elasticache address depending on if the resource was created. This is a known and well documented hack people are recommending until v0.12 is released which will allow ternary expressions to evaluate correctly with potentially missing resources. This behaviour does work as expected with other resources such as EC2 ip addresses and RDS SQL endpoints.
Actual Behavior
Steps to Reproduce
Running
terraform apply
when the install_redis variable is set to true returns the error.Running
terraform apply
when the install_redis variable is set to false returns the correct behaviour of an empty string outputted.Commenting out the output block, running 'terraform apply', then adding the output back, running 'terraform apply' a second time correctly returns the elasticache endpoint address.
Additional Context
Alternatively trying
returns
It appears the evaluation of the expression differs depending on if terraform knows the resource will be created or not and the evaluation appears to work differently due to the nested lists. Are there alternative recommended approaches/hacks to conditionally output the elasticache endpoint address ?
The text was updated successfully, but these errors were encountered: