-
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
Add Computed flag set to true for Port property in ElastiCache Cluster #10017
Add Computed flag set to true for Port property in ElastiCache Cluster #10017
Conversation
Forces proper order resource creation when reading this property externally
Hi @xsalazar ! Thanks so much for the detailed explanation and use case. Can you have a look at the acceptance tests for the resource and add a new test to demonstrate the change? Let us know if you need pointers on where to start. |
@aeschright I went ahead and added a test around this scenario! |
Any update on this? @aeschright |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good at first read, thank you! Please run make fmt
to clean up the linter errors, then I can verify the acceptance tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we're good to go! Thanks for taking care of this.
--- PASS: TestAccAWSElasticacheCluster_Port_Redis_Default (524.58s)
@aeschright thanks for being responsive this long and helping get this in! 🚀 |
This has been released in version 2.48.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
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! |
Summary
Sets the Computed flag to true for the
aws_elasticache_cluster
resource. This property is already exposed as readable; however, there was a lack of identification to tell other resources to wait for the value to be set before using it. This is especially important when utilizing the default ports for both Memcached and Redis, since they will not be set explicitly in Terraform and only get a value after the resource is created.The Existing Issue
Currently, the
port
property on theresource_aws_elasticache_cluster
is allowed to be read externally and used throughout other resources; however, there was no explicit identifier to tell other resources when it would be safe to read this property.For example, if you set up an
aws_elasticache_cluster
as follows:And you also wish to set up an
aws_security_group
to create an ingress rule using the port exposed by this cluster:You get the following error on apply:
This property is eventually set; however, Terraform does not know to wait until the cluster resource is created to read this property
What's Fixed
You can see below that the new plan generated by Terraform is successful and also correctly identifies that the ingress rule will properly set the to- and from-port after the apply is done. Further, you can see the resource creation explicitly waits until the
aws_elasticache_cluster
is complete to start creating theaws_security_group
.Community Note
Release Notes
Release note for CHANGELOG:
Test
Output from acceptance testing: