Skip to content

[Bug]: serverless elasticache major version upgrade recreates a new resourceΒ #41644

@jbrandhorst

Description

@jbrandhorst

Terraform Core Version

1.7.5

AWS Provider Version

5.76.0

Affected Resource(s)

aws_elasticache_serverless_cache

Expected Behavior

AWS allows for upgrading the major_engine_version attribute of an existing serverless cache via the AWS console or using the Elasticache API, see: https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/VersionManagement.html#VersionManagement-serverless

Updating the major engine version from "7" to "8" should not trigger a destroy + recreation of an existing resource.

Actual Behavior

Modifying the major engine version from "7" to "8" on a serverless cluster resource does not attempt to do an in-place version upgrade that AWS supports, instead the provider wants to destroy the cluster and create a new one, see:

stringplanmodifier.RequiresReplace(),

Relevant Error/Panic Output Snippet

# aws_elasticache_serverless_cache.dev-serverless-valkey must be replaced
-/+ resource "aws_elasticache_serverless_cache" "dev-serverless-valkey" {
      ~ full_engine_version      = "7.2" -> (known after apply)
      ~ id                       = "dev-serverless-valkey" -> (known after apply)
      ~ major_engine_version     = "7" -> "8" # forces replacement

<several other attributes indicating that they will be known after apply>

Terraform Configuration Files

resource "aws_elasticache_serverless_cache" "dev-serverless-valkey" {
name = "dev-serverless-valkey"
description = "Valkey serverless cache"

engine = "valkey"
major_engine_version = "8"

subnet_ids = [, , ]
security_group_ids = []

user_group_id =
}

Steps to Reproduce

  • create a aws_elasticache_serverless_cache resource with the major_engine_version attribute set to "7"
  • update the major_engine_version value to "8"
  • run a plan
  • observe that the provider wants to replace the existing serverless cache with a completely new serverless cache, rather than doing the in-place upgrade

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAddresses a defect in current functionality.service/elasticacheIssues and PRs that pertain to the elasticache service.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions