aws_autoscaling_group collapses all tags with values unspecified until apply into a single value, resulting in an inconsistent plan on apply #17416
Labels
bug
Addresses a defect in current functionality.
service/autoscaling
Issues and PRs that pertain to the autoscaling service.
Community Note
Terraform CLI and Terraform AWS Provider Version
Terraform v0.14.5
Affected Resource(s)
Terraform Configuration Files
Complete test cases showing working and error scenarios with detailed analysis/guesses in README.md at https://github.com/sriddell/aws_autoscaling_group_error_example
Debug Output
plan debug: https://gist.github.com/sriddell/4316a722c9b3186d16b998677ba24bdc
apply debug https://gist.github.com/sriddell/214c223b53484adc7374213830f90699
--->
Panic Output
Expected Behavior
Plan should have been applied without error.
Actual Behavior
Apply failed with "Provider produced inconsistent final plan".
The README.md in https://github.com/sriddell/aws_autoscaling_group_error_example has full details, but the basic problem appears to be that the aws_autoscaling_group resource, when presented with 2 or more tags in the "tags" attribute with keys or values that are unspecified until apply time, collapses them all down into a single unspecified value in the "tags" list. This means that when the plan is applied, the tags list expands to be larger than it as in the plan, which violates the checks in the assertValueCompatible function in compatible.go from terraform-core, which allows a list to shrink in size, but not expand during the apply.
Steps to Reproduce
terraform plan -out plan
terraform apply plan
The text was updated successfully, but these errors were encountered: