hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.82k stars 9.17k forks source link

[Bug]: Updating aurora rds postgresql engine version #36099

Open adityabraj opened 8 months ago

adityabraj commented 8 months ago

Terraform Core Version

0.13.2

AWS Provider Version

4.47,4.62,5.39.1

Affected Resource(s)

aws_rds_cluster

Expected Behavior

Upgrade Aurora RDS PostgreSQL DB engine version from 11.21 to 15.5

Actual Behavior

During terraform apply, aurora db upgrade fails.

Screenshot 2024-03-06 at 12 11 59 AM

Relevant Error/Panic Output Snippet

Error: Provider produced inconsistent final plan
When expanding the plan for module.rds_cluster.aws_rds_cluster_instance.aurora-cluster-instances[0] to include new values learned so far during apply, provider│ "registry.terraform.io/hashicorp/aws" produced an invalid new value for .engine_version: was cty.StringVal("15.5"), but now cty.StringVal("11.21"). This is a bug in the provider, which should be reported in the provider's
own issue tracker.

Terraform Configuration Files

provider.tf

# Configure the AWS Provider
provider "aws" {
  region = "eu-central-1"
  sts_region = "eu-central-1"
  assume_role {
      role_arn = var.assume_role_arn
}
}
terraform {
  required_version = ">= 1.0"

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 5.39.1"
    }
    kubernetes = {
      source  = "hashicorp/kubernetes"
      version = ">= 2.10"
    }
  }
}

aurora-rds.tf

################################################################################
# Aurora Postgresql RDS
################################################################################
module "rds_cluster" {
  source                       = "git::https://gitlab.com/syngentagroup/Terraform-Modules/terraform-aws-rds-aurora.git/?ref=main"
  #allocated_storage  =  10
  cluster_storage_type = ""
  db_cluster_instance_class = ""
  identifier_count             = var.identifier_count
  region                       = var.region
  application_code             = "gis"
  environment                  = var.environment
  engine                       = var.engine
  engine_version               = "15.5"
  apply_immediately            = true
  instance_class               = var.instance_class
  storage_encrypted            = false
  availability_zones           = ["eu-central-1a"]
  vpc_security_group_ids       = [module.rds_sg.security_group_id]
  db_subnet_group_name         = "**********"
  cluster_parameter_group_name = null                                                                        # if default pass null
  parameter_group_name         = null                                                                              # if default pass null
  snapshot_identifier          = "arn:aws:rds:eu-central-1:***********:cluster-snapshot:*******"
  deletion_protection          =  true
  master_username              = "******"
  multi_az                     = false
  number_of_read_replicas      = var.number_of_read_replicas ## modify this attributes if you want to have more than 1 read replicas during the time of multi-az value is true
  tags                         = local.tags
}

Steps to Reproduce

  1. Run terraform apply with engine_version = 11.21
  2. Run terraform apply with engine_version = 15.5

Debug Output

No response

Panic Output

No response

Important Factoids

I have tried work arounds mentioned in other similar issues like providing the engine_version explicitly rather than as a reference to the cluster resource and setting apply_immediately to true, but it did not help, same output.

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 8 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

justinretzolk commented 7 months ago

Similar #36004