Skip to content

Can't import existing aws_elasticache_replication_group without recreate resource #207

@ABRIO-PR

Description

@ABRIO-PR

Describe the Bug

After importing an existing AWS ElastiCache for Redis, terraform wants to recreate it. This is caused by the "security_group_names" parameter. The other options in my template match the existing resource.

-/+ resource "aws_elasticache_replication_group" "default" {
      ~ arn                            = "arn:aws:elasticache:us-east-1:276741630740:replicationgroup:redis" -> (known after apply)
      ~ cluster_enabled                = false -> (known after apply)
      + configuration_endpoint_address = (known after apply)
      ~ engine_version_actual          = "6.2.6" -> (known after apply)
      + global_replication_group_id    = (known after apply)
      ~ id                             = "redis" -> (known after apply)
      ~ member_clusters                = [
          - "redis-001",
        ] -> (known after apply)
      ~ num_node_groups                = 1 -> (known after apply)
      ~ primary_endpoint_address       = "redis.6jpnqy.ng.0001.use1.cache.amazonaws.com" -> (known after apply)
      ~ reader_endpoint_address        = "redis-ro.6jpnqy.ng.0001.use1.cache.amazonaws.com" -> (known after apply)
      ~ replicas_per_node_group        = 0 -> (known after apply)
      + security_group_names           = (known after apply) # forces replacement
        tags                           = {
            "Name" = "redis"
        }
      - user_group_ids                 = [] -> null
        # (21 unchanged attributes hidden)
    }

By adding to the resource 'resource "aws_elasticache_replication_group" "default"' in the module

  lifecycle {
    ignore_changes = [
      security_group_names,
    ]
  }

it works great and Terraform doesn't find any changes.

The module does not support the "security_group_names" parameter

Expected Behavior

No changes. Your infrastructure matches the configuration.

Steps to Reproduce

terraform import 'module.redis-cluster["elasticache-redis"].aws_elasticache_replication_group.default[0]' elasticache-redis

Screenshots

No response

Environment

Module version = "0.53.0"
Terraform version = "1.5.0"
Provider version = "5.21.0"

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug🐛 An issue with the system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions