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

Default Termination Policy must be last #3880

Closed
blairham opened this issue Nov 12, 2015 · 3 comments
Closed

Default Termination Policy must be last #3880

blairham opened this issue Nov 12, 2015 · 3 comments

Comments

@blairham
Copy link

When adding multiple termination policies to an autoscaling group and one of them is the 'Default', the 'Default' must be last in the list. Terraform currently does not respect that. Here is the sample code that would demonstrate this case:

variable "termination_policies" {
default = "OldestInstance,Default"
}

resource "aws_autoscaling_group" "blue" {
...
termination_policies = ["${split(",", var.termination_policies)}"]
...
}

@pforman
Copy link
Contributor

pforman commented Nov 13, 2015

This should be mostly addressed by #2890, which was merged for upcoming release in 0.6.7.

The reason you're seeing that behavior is that prior to #2890 the list was implemented as a hashed set, so the order was dependent on the hash values of the items.

I fixed that so well-defined cases (like yours) will work properly. Terraform doesn't currently allow for validating the contents of a list parameter, so if you provide something like

termination_policies = ["Default","OldestInstance"]

it will pass a terraform plan but fail on terraform apply (with a meaningful error message).

So AWS will enforce that "Default" must be last, but Terraform can't (yet). However, in 0.6.7 it should respect the order provided.

@blairham
Copy link
Author

This looks great @pforman, thanks!

@ghost
Copy link

ghost commented Apr 29, 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 Apr 29, 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

3 participants