-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
aws_elasticache_cluster does not allow duplicate availability_zones values #2658
Comments
Hi @cep21! It looks like that attribute is defined as being a set rather than a list, which means it's an unordered collection without duplicates. So indeed you are right that it is being deduped within Terraform's type system, due to the data type specified here. It looks like #2685 is already proposing the solution to this, if we think that preserving order and allowing duplicates is the better behavior here. I am not personally familiar enough with ElastiCache to know what's best here, but I did spend some time reading the relevant documentation and I think I see what happened here: The documentation for However, later on the same documentation discusses the idea of repeating the same availability zone multiple times to put all the nodes in the same availability zone, suggesting that duplicates are in fact expected. It doesn't discuss the possibility of having a mixed list with several different zones but some duplicated, but I'd agree that this seems like a logical extension of the recommendation about a homogeneous list of zones. The Terraform team is about to begin a break for the holidays, so hopefully we can take a closer look at PR #2685 in the new year. |
What the endpoint is trying to do, is you specify 5 servers, then you specify which AZ each those 5 servers go into. The order doens't matter, because if you list us-west-2a first or last, you still get a server in us-west-2a. But it's not a set, it has to allow duplicates because you may want 2 servers in us-west-2a, and only one in us-west-2b. That list would look like [us-west-2a, us-west-2a, us-west-2b] or it could look like [us-west-2a, us-west-2b, us-west-2a]. The correct behavior for terraform would be to sort the list first, then compare for changes. |
It will -- I do need to actually submit the PR sometime shortly that will introduce the new attribute (e.g. |
Pull request submitted: #4741 |
The |
This has been released in version 1.23.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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! |
Terraform Version
< terraform -v
Terraform v0.11.1
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
Expected Behavior
Create a cluster in 6 AZ.
Actual Behavior
InvalidParameterCombination: Must specify the same number of preferred availability zones as requested number of nodes
Steps to Reproduce
Create a cluster with the same AZ name multiple times inside
availability_zones
Important Factoids
I think something is deduping the
availability_zones
list, when it shouldn't be deduped. Theplan
step showsEven though the list size is 6.
Passing in just 3, unique
availability_zones
values will complain that the passed in list size isn't equal tonum_cache_nodes
value (6 in this case).Or the logic should be smart enough to take a list that is only 3 AZ, but have some knowledge of how to distribute them.
The text was updated successfully, but these errors were encountered: