terraform-provider-aws: Error: aws_autoscaling_group - Provider produced inconsistent final plan

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave “+1” or “me too” comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

v0.12.6

Affected Resource(s)

  • aws_autoscaling_group

Expected Behavior

terraform apply should finish with no errors

Actual Behavior

Error: Provider produced inconsistent final plan

When expanding the plan for module.eks_stack.aws_autoscaling_group.as_node_group to include new values learned so far during apply, provider “aws” produced an invalid new value for .availability_zones: was known, but now unknown.

This is a bug in the provider, which should be reported in the provider’s own issue tracker.

Steps to Reproduce

  1. terraform apply

Important Factoids

This completes OK on running a second terraform apply

References

This issue was originally raised in the terraform GitHub, but then following an update of terraform, the error produced mentioned an issue with provider. I was advised to then open an issue with the provider. Ref: https://github.com/hashicorp/terraform/issues/21012

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 74
  • Comments: 22 (7 by maintainers)

Most upvoted comments

Hey, i can confirm we’re still facing this issue :

│ Error: Provider produced inconsistent final plan
│
│ When expanding the plan for aws_autoscaling_group.workers_3a to include new values learned so far during apply, provider "registry.terraform.io/hashicorp/aws" produced an
│ invalid new value for .tags: planned set element cty.MapValEmpty(cty.String) does not correlate with any element in actual.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Another kind of error that we’re facing:

│ Error: Provider produced inconsistent final plan
│
│ When expanding the plan for aws_autoscaling_group.workers_3a to include new values learned so far during apply, provider "registry.terraform.io/hashicorp/aws" produced an
│ invalid new value for .tags: length changed from 10 to 11.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

These errors are only happening when we’re creating an aws_eks_cluster (which takes roughly 13min), an aws_launch_template and the aws_autoscaling_group on the same run. (3 resources)

Once the EKS cluster is created (and the failure of the apply), we can relaunch a terraform apply and create the launch template and the autoscaling group without any issues. Maybe related to something computed at the beginning of the run that is updated later on?

By the way : we’re using the latest version of the provider (“3.69.0”) and terraform version 1.1.0

I’ve seen this as well, but I think it’s because I’m using a value from random_string in the tags; the random value isn’t available until apply-time, at which point terraform freaks out that things have changed. In fact, the list of tags during the plan shows that some items are (known after apply).

However, since Terraform knows that the values won’t be known until they’re available, it should proceed without throwing the warning.

Here’s the actual output:

Error: Provider produced inconsistent final plan

When expanding the plan for module.example_asg.aws_autoscaling_group.app[0] to
include new values learned so far during apply, provider
"registry.terraform.io/-/aws" produced an invalid new value for .tags: length
changed from 6 to 8.

This is a bug in the provider, which should be reported in the provider's own
issue tracker.

This is the output of terraform -version:

Terraform v0.12.24
+ provider.aws v2.64.0
+ provider.random v2.2.1
+ provider.template v2.1.2

This happened to me because I was using both availability_zones and vpc_zone_identifier in aws_autoscaling_group.

The documentation mentions:

availability_zones - (Required only for EC2-Classic) A list of one or more availability zones for the group. This parameter should not be specified when using vpc_zone_identifier.

The error is gone if I don’t specify the two, but it took a little sleuthing to piece this together.

Looks very similar to https://github.com/terraform-providers/terraform-provider-aws/issues/10615

Sometimes just running terraform apply again will work. But if it doesn’t, as a workaround you can mark the resource as tainted with -taint and then run terraform apply again. This will force the resource to be re-created.

@justinretzolk I have not seen this problem in quite some time. For the record, we are mostly on aws provider version 3.54+ and Terraform 1.0.0+ at this point.