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.61k stars 9k forks source link

Upgrade to redis6.x in aws_elasticache_replication_group fails #21733

Open severino42 opened 2 years ago

severino42 commented 2 years ago

Community Note

Terraform CLI and Terraform AWS Provider Version

Terraform v0.13.7

Affected Resource(s)

aws_elasticache_replication_group

Expected Behavior

redis cluster upgraded to 6.0

Actual Behavior

Terraform will perform the following actions:

  # module.netbox.aws_elasticache_replication_group.netbox will be updated in-place
  ~ resource "aws_elasticache_replication_group" "netbox" {
        arn                           = "arn:aws:elasticache:us-east-1:<ID>:replicationgroup:netbox"
        at_rest_encryption_enabled    = false
        auto_minor_version_upgrade    = true
        automatic_failover_enabled    = true
        cluster_enabled               = false
        engine                        = "redis"
        engine_version                = "5.0.6"
        engine_version_actual         = "5.0.6"
        id                            = "netbox"
        maintenance_window            = "thu:06:30-thu:07:30"
        member_clusters               = [
            "netbox-001",
            "netbox-002",
        ]
      ~ multi_az_enabled              = true -> false
        node_type                     = "cache.t2.small"
        number_cache_clusters         = 2
      ~ parameter_group_name          = "default.redis5.0" -> "default.redis6.x"
        port                          = 6379
        primary_endpoint_address      = "netbox.defpyl.ng.0001.use1.cache.amazonaws.com"
        reader_endpoint_address       = "netbox-ro.defpyl.ng.0001.use1.cache.amazonaws.com"
        replication_group_description = "redis for netbox"
        replication_group_id          = "netbox"
        security_group_ids            = [
            "sg-0c1c477376241abe5",
        ]
        security_group_names          = []
        snapshot_retention_limit      = 0
        snapshot_window               = "08:00-09:00"
        subnet_group_name             = "netbox"
        tags                          = {
            "Name"          = "netbox"
            "business-unit" = "infrastructure"
            "managed-by"    = "terraform"
            "role"          = "netbox"
        }
        tags_all                      = {
            "Name"          = "netbox"
            "business-unit" = "infrastructure"
            "managed-by"    = "terraform"
            "role"          = "netbox"
        }
        transit_encryption_enabled    = false

        cluster_mode {
            num_node_groups         = 1
            replicas_per_node_group = 1
        }

        timeouts {}
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

module.netbox.aws_elasticache_replication_group.netbox: Modifying... [id=netbox]

Error: error updating ElastiCache Replication Group (netbox): InvalidParameterValue: The parameter CacheParameterGroupName is not a valid identifier. Identifiers must begin with a letter; must contain only ASCII letters, digits, and hyphens; and must not end with a hyphen or contain two consecutive hyphens.
    status code: 400, request id: <ID>

  on .terraform/modules/netbox/elasticache.tf line 23, in resource "aws_elasticache_replication_group" "netbox":
  23: resource "aws_elasticache_replication_group" "netbox" {

Steps to Reproduce

  1. Running redis cluster with parameter_group_name = "default.redis5.0"
  2. Update to parameter_group_name = ""default.redis6.x"
  3. terraform apply

References

https://github.com/hashicorp/terraform-provider-aws/issues/15625 https://github.com/hashicorp/terraform-provider-aws/issues/16564

andraspatka commented 1 year ago

Seems to be fixed in terraform 1.4.5 with provider registry.terraform.io/hashicorp/aws version 4.63.0