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

Provider produced inconsistent final plan -> aws_elastic_beanstalk_environment #15054

Closed
julioalpa opened this issue Sep 7, 2020 · 2 comments
Labels
service/elasticbeanstalk Issues and PRs that pertain to the elasticbeanstalk service. service/rds Issues and PRs that pertain to the rds service.

Comments

@julioalpa
Copy link

julioalpa commented Sep 7, 2020

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 CLI and Terraform AWS Provider Version

Terraform v0.12.24

  • provider.aws v2.64.0

Affected Resource(s)

  • aws_elastic_beanstalk_environment

Terraform Configuration Files

resource "aws_rds_cluster" "rds_telemedicina" {
  count                     = var.rds_serverless ? 1 : 0
  cluster_identifier        = var.env_full_name
  engine                    = "aurora-mysql"
  engine_mode               = "serverless"
  master_username           = var.rds_master_username
  master_password           = var.rds_master_password
  skip_final_snapshot       = "false"
  availability_zones        = ["${var.aws_region}c"]
  final_snapshot_identifier = "${var.env_full_name}-final-snapshot"
  deletion_protection       = "false"
  snapshot_identifier       = data.aws_db_cluster_snapshot.rds_snapshot[0].id
  vpc_security_group_ids    = var.rds_vpc_security_group_ids
  tags                      = var.tags
  db_subnet_group_name      = var.rds_db_subnet_group_name
  copy_tags_to_snapshot     = "true"
  backup_retention_period   = var.rds_backup_retention_period
  
  scaling_configuration {
   auto_pause               = "true"
    max_capacity             = 1
    min_capacity             = 1
    seconds_until_auto_pause = 300
    timeout_action           = "ForceApplyCapacityChange"
  }

  lifecycle {
    ignore_changes = [
      snapshot_identifier,
      engine_version,
      availability_zones
    ]
  }
}

locals {
  rds_endpoint = "${var.rds_serverless ? aws_rds_cluster.rds_telemedicina[0].endpoint : aws_db_instance.rds_telemedicina[0].endpoint}"
  rds_port     = "${var.rds_serverless ? aws_rds_cluster.rds_telemedicina[0].port     : aws_db_instance.rds_telemedicina[0].port}"
}

resource "aws_elastic_beanstalk_environment" "env_telemedicina" {
  name                = "${var.env_full_name}-telemedicina"
  application         = data.aws_elastic_beanstalk_application.telemedicina.name
  solution_stack_name = var.solution_stack_name
  tier                = "WebServer"

setting {
    namespace = "aws:elasticbeanstalk:application:environment"
    name      = "DB_PORT"
    value     = local.rds_port
  }

Panic Output

Error: Provider produced inconsistent final plan

When expanding the plan for
module.infrastructure.module.backend.aws_elastic_beanstalk_environment.env_telemedicina
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("DB_PORT"),
"namespace":cty.StringVal("aws:elasticbeanstalk:application:environment"),
"resource":cty.StringVal(""), "value":cty.UnknownVal(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.

Expected Behavior

terraform apply successfully

Actual Behavior

The environments envars of the elastic beanstalk web server are not updated

Steps to Reproduce

  1. terraform apply

Important Factoids

  • EC2 Amazon Linux
  • Aurora serverless

References

@ghost ghost added service/elasticbeanstalk Issues and PRs that pertain to the elasticbeanstalk service. service/rds Issues and PRs that pertain to the rds service. labels Sep 7, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 7, 2020
@julioalpa
Copy link
Author

Just an "depends_on" property solved my problem.
The root of the problem was terraform tried to apply the elastic beanstalk environment changes but the RDS was not available yet.

@ghost
Copy link

ghost commented Oct 9, 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Oct 9, 2020
@breathingdust breathingdust removed the needs-triage Waiting for first response or review from a maintainer. label Sep 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/elasticbeanstalk Issues and PRs that pertain to the elasticbeanstalk service. service/rds Issues and PRs that pertain to the rds service.
Projects
None yet
Development

No branches or pull requests

2 participants