I was using version 0.6.14 with an aws_autoscaling_policy defined with a min_adjustment_step value of 1. When I upgraded to 0.6.15, I saw the deprecation warning, so I replaced min_adjustment_step with min_adjustment_magnitude as I understood them to do the same thing, just one name is deprecated.
I then ran terraform plan and terraform apply to get it to a clean state. Everything succeeds and all is well, but to be safe, I run terraform plan again and I see:
~ aws_autoscaling_policy.shrink-ten-percent
min_adjustment_step: "1" => "0"
I have tried applying the above plan, and it also succeeds:
aws_autoscaling_policy.shrink-ten-percent: Modifying...
min_adjustment_step: "1" => "0"
aws_autoscaling_policy.shrink-ten-percent: Modifications complete
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
But I can never get a plan or apply to tell me nothing need to change, even though the .tf config hasn't been modified since.
v0.6.15
resource "aws_autoscaling_policy" "shrink-ten-percent" {
name = "shrink-ten-percent"
scaling_adjustment = -10
adjustment_type = "PercentChangeInCapacity"
min_adjustment_magnitude = 1
autoscaling_group_name = "${aws_autoscaling_group.webservers.name}"
}
I have far too many other resources in a terraform plan run to show the debug output.
I expected terraform plan to not show any changes, and terraform apply to not try to do anything.
terraform plan always shows the min_adjustment_step going to 0, and terraform apply always successfully applies the change.
terraform planterraform applyplan or apply with no changes.Nothing too strange about my AWS setup, just using a usual autoscale group with a launch config running Ubuntu Trusty AMIs. Everything's in a VPC.
Hey @boboli thanks for writing in. I can see the bug in the UPDATE code:
if v, ok := d.GetOk("min_adjustment_step"); ok {
params.MinAdjustmentStep = aws.Int64(int64(v.(int)))
}
you've removed or set min_adjustment_step to 0, either way, d.GetOk will return false there for the ok value, because it's finding the default zero value for the attribute. In that context, GetOk says "false", when we really do want to just just clear that value...
I'm working on a fix for this, in the meantime you may want to simply remove the offending min_adjustment_step from your statefile. I don't normally like to suggest people do this, but in your case I wanted you to get past this annoyance/bug without having to wait on the fix 😦
Thanks for the quick response!
If by statefile you mean the terraform.tfstate, then I've already tried it, and it doesn't work. After I wipe that value from the statefile, another terraform plan just puts the "min_adjustment_step": 1 back in, and says it'll set it from 1 to 0 again. :(
@boboli yeah I figured that out myself shortly after posting that. I think I have a fix in place I'm just testing it now, hopefully post that today.
Sorry for the trouble!
The fix is in https://github.com/hashicorp/terraform/pull/6440 and should tidy up the reoccurring plan
https://github.com/hashicorp/terraform/pull/6440 was merged and will go out in the next release (this week, I think)
Great, thanks! Looking forward to using the new release!
Just tested it with 0.6.16, and it's indeed fixed. Thanks for the quick turnaround!
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.