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

aws_elastic_beanstalk_environment Error: Provider produced inconsistent final plan #13823

Closed
yashshanker opened this issue Jun 18, 2020 · 8 comments
Labels
bug Addresses a defect in current functionality. service/elasticbeanstalk Issues and PRs that pertain to the elasticbeanstalk service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.

Comments

@yashshanker
Copy link

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 other comments that do not add relevant new information or questions, 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

Terraform v0.12.26
+ provider.aws v2.66.0
+ provider.random v2.2.1
+ provider.time v0.5.0

Affected Resource(s)

  • aws_elastic_beanstalk_environment

Terraform Configuration Files

resource "aws_elastic_beanstalk_environment" "my-eb-env" {
  name        = "${aws_elastic_beanstalk_application.my-eb-app.name}-v1"
  application = aws_elastic_beanstalk_application.my-eb-app.name

  solution_stack_name = "64bit Amazon Linux 2018.03 v2.20.3 running Multi-container Docker 19.03.6-ce (Generic)"
  tier                = "WebServer"

  setting {
    namespace = "aws:autoscaling:launchconfiguration"
    name      = "ImageId"
    value     = var.ami
  }

  # Application configuration variables
  setting {
    namespace = "aws:elasticbeanstalk:application:environment"
    name      = "READ_DB_HOST"
    value     = aws_db_instance.my_replica_db.address
  }
}

Panic Output

Error: Provider produced inconsistent final plan

When expanding the plan for aws_elastic_beanstalk_environment.my-eb-env to include
new values learned so far during apply, provider "registry.terraform.io/-/aws"
produced an invalid new value for .setting: planned set element
cty.ObjectVal(map[string]cty.Value{"name":cty.StringVal("READ_DB_HOST"),
"namespace":cty.StringVal("aws:elasticbeanstalk:application:environment"),
"resource":cty.NullVal(cty.String), "value":cty.StringVal("something")}) 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.

Expected Behavior

This is a part of a bigger configuration, which has all my infra's configuration. When I do terraform apply for the first time, it applies successfully and sets up my infra. Then subsequently, if I change anything, suppose security groups' ingress/egress CIDRs, it should apply and make those changes.

Actual Behavior

The first terraform apply get applied successfully, but subsequently, when I do changes, suppose changes in security groups' ingress/egress CIDRs, it ends up with an error which is mentioned above.

By the way, there are more settings in my elastic_beanstalk_environment resource, and this error is for all of them.

Steps to Reproduce

  1. terraform apply

References

@ghost ghost added the service/elasticbeanstalk Issues and PRs that pertain to the elasticbeanstalk service. label Jun 18, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Jun 18, 2020
@vanwalj
Copy link

vanwalj commented Jun 18, 2020

Just got a similar issue

Error: Provider produced inconsistent final plan
 When expanding the plan for aws_s3_bucket_object.lambda to include new values
 learned so far during apply, provider "registry.terraform.io/hashicorp/aws"
 changed the planned action from CreateThenDelete to DeleteThenCreate.
 This is a bug in the provider, which should be reported in the provider's own
 issue tracker.

Everything was working fine so far, but I changed a value: scaling_configuration.seconds_until_auto_pause in an aws_rds_cluster ressource, and since then, all subsequent apply failed

@yashshanker
Copy link
Author

@vanwalj if you are sure it is because of some change in rds cluster, then most probably there is something wrong with the config.

I just saw that I was writing the wrong configuration for RDS here, and once I resolved my config for RDS, there were no more errors in other resources.

Try it out, and let me know.

@vanwalj
Copy link

vanwalj commented Jun 19, 2020

@yashshanker just found what caused the issue, we were applying our terraform config in a ci pipeline using the docker hashicorp/terraform:full image which was recently updated to use the "0.13-beta" version of terraform which literally obliterate our infrastructure, rolling back to 12.26 fixed the issue

@breathingdust breathingdust added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 10, 2020
@mslipper
Copy link

mslipper commented Jul 28, 2020

I have a reproducible test case for this.

First, create an SQS queue resource with a corresponding data resource as follows:

resource "aws_sqs_queue" "queue" {
  name = "super_duper_queue"
  max_message_size = 2048
  visibility_timeout_seconds = 300
}

data "aws_sqs_queue" "queue" {
  name = aws_sqs_queue.queue.name
  depends_on = [aws_sqs_queue.queue]
}

Then, pipe the report URL into an EB environment variable:

// other directives cut for brevity
  setting {
    namespace = "aws:elasticbeanstalk:application:environment"
    name = "SQS_QUEUE_URL"
    value = data.aws_sqs_queue.queue.url
  }

It'll work on the first apply, but will stop working after that with the following error:

Error: Provider produced inconsistent final plan
When expanding the plan for aws_elastic_beanstalk_environment.my_env to
include new values learned so far during apply, provider
"registry.terraform.io/-/aws" produced an invalid new value for .setting:
planned set element
cty.ObjectVal(map[string]cty.Value{"name":cty.StringVal("InstanceTypes"),
"namespace":cty.StringVal("aws:ec2:instances"),
"resource":cty.NullVal(cty.String), "value":cty.StringVal("t2.micro")}) 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.

Commenting out the depends_on in the data resource fixes the issue.

@zygimantas
Copy link

The same happens while changing cpu from 1024 to 256 in aws_ecs_task_definition

When expanding the plan for module.aws_region_us1.aws_ecs_task_definition.main
to include new values learned so far during apply, provider
"registry.terraform.io/hashicorp/aws" changed the planned action from
CreateThenDelete to DeleteThenCreate.

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

Terraform v0.13.0

  • provider registry.terraform.io/-/aws v3.3.0
  • provider registry.terraform.io/hashicorp/aws v3.3.0

@bflad
Copy link
Contributor

bflad commented Oct 27, 2020

For folks running into the changed the planned action from CreateThenDelete to DeleteThenCreate error, I believe this was fixed upstream in Terraform CLI by hashicorp/terraform#26192, which was released in Terraform 0.13.3. If you are still running into this same error after upgrading Terraform CLI itself, please open an issue upstream in https://github.com/hashicorp/terraform/issues since that particular error cannot be fixed in Terraform Providers (see referenced pull request for more details).

@github-actions
Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Oct 17, 2022
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 17, 2022
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/elasticbeanstalk Issues and PRs that pertain to the elasticbeanstalk service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Projects
None yet
Development

No branches or pull requests

6 participants