terraform-provider-aws icon indicating copy to clipboard operation
terraform-provider-aws copied to clipboard

aws_elasticache_replication_group global replication group id InvalidParameterCombination

Open aleksandar-babic opened this issue 2 years ago • 18 comments

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 v1.1.9
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v4.14.0
+ provider registry.terraform.io/hashicorp/random v3.1.3

Affected Resource(s)

  • aws_elasticache_replication_group

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "aws_elasticache_subnet_group" "primary" {
  name       = "${var.backend_prefix}-elasticache-primary"
  subnet_ids = module.backend_vpc.private_subnets
}

resource "aws_elasticache_global_replication_group" "this" {
  global_replication_group_id_suffix = var.backend_prefix
  primary_replication_group_id       = aws_elasticache_replication_group.primary.id
}

resource "aws_elasticache_replication_group" "primary" {
  replication_group_id          = "${var.backend_prefix}-redis-rg"
  replication_group_description = "Primary replication group"

  engine                = "redis"
  engine_version        = "5.0.6"
  node_type             = "cache.m5.large"
  security_group_ids    = [aws_security_group.redis.id]
  subnet_group_name     = aws_elasticache_subnet_group.primary.name
  apply_immediately     = true
  number_cache_clusters = 1
}


resource "aws_elasticache_replication_group" "secondary" {
  provider = aws.frontend

  replication_group_id          = "${var.frontend_prefix}-us-redis-secondary-rg"
  replication_group_description = "Secondary replication group"

  global_replication_group_id = aws_elasticache_global_replication_group.this.global_replication_group_id
  security_group_ids          = [aws_security_group.redis_frontend.id]
  subnet_group_name           = aws_elasticache_subnet_group.secondary.name
}

Debug Output

---[ REQUEST POST-SIGN ]-----------------------------
POST / HTTP/1.1
Host: elasticache.us-east-1.amazonaws.com
User-Agent: APN/1.0 HashiCorp/1.0 Terraform/1.1.9 (+https://www.terraform.io) terraform-provider-aws/dev (+https://registry.terraform.io/providers/hashicorp/aws) aws-sdk-go/1.44.10 (go1.17.6; darwin; arm64)
Content-Length: 230
Authorization: AWS4-HMAC-SHA256 Credential=/20220518/us-east-1/elasticache/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date, Signature=e776d3a9db3b8d328f0fd8f533740f69cc5eb90728e1887f8761af57f2f79a5c
Content-Type: application/x-www-form-urlencoded; charset=utf-8
X-Amz-Date: 20220518T142815Z
Accept-Encoding: gzip

Action=CreateReplicationGroup&AutoMinorVersionUpgrade=true&GlobalReplicationGroupId=iudkw-backend-poc&ReplicationGroupDescription=Secondary+replication+group&ReplicationGroupId=frontend-poc-us-redis-secondary-rg&Version=2015-02-02
-----------------------------------------------------: timestamp=2022-05-18T16:28:15.546+0200
2022-05-18T16:28:16.085+0200 [DEBUG] provider.terraform-provider-aws_v4.14.0_x5: [aws-sdk-go] DEBUG: Response elasticache/CreateReplicationGroup Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 400 Bad Request
Connection: close
Content-Length: 374
Content-Type: text/xml
Date: Wed, 18 May 2022 14:28:15 GMT
X-Amzn-Requestid: 93343807-e7f7-49c4-85ea-8cf403acaaf1


-----------------------------------------------------: timestamp=2022-05-18T16:28:16.083+0200
2022-05-18T16:28:16.085+0200 [DEBUG] provider.terraform-provider-aws_v4.14.0_x5: [aws-sdk-go] <ErrorResponse xmlns="http://elasticache.amazonaws.com/doc/2015-02-02/">
  <Error>
    <Type>Sender</Type>
    <Code>InvalidParameterCombination</Code>
    <Message>Cannot use the given parameters when creating new replication group in an existing global replication group.</Message>
  </Error>
  <RequestId>93343807-e7f7-49c4-85ea-8cf403acaaf1</RequestId>
</ErrorResponse>: timestamp=2022-05-18T16:28:16.083+0200
2022-05-18T16:28:16.085+0200 [DEBUG] provider.terraform-provider-aws_v4.14.0_x5: [aws-sdk-go] DEBUG: Validate Response elasticache/CreateReplicationGroup failed, attempt 0/25, error InvalidParameterCombination: Cannot use the given parameters when creating new replication group in an existing global replication group.
        status code: 400, request id: 93343807-e7f7-49c4-85ea-8cf403acaaf1: timestamp=2022-05-18T16:28:16.083+0200
2022-05-18T16:28:16.128+0200 [ERROR] vertex "aws_elasticache_replication_group.secondary" error: error creating ElastiCache Replication Group (frontend-poc-us-redis-secondary-rg): InvalidParameterCombination: Cannot use the given parameters when creating new replication group in an existing global replication group.
        status code: 400, request id: 93343807-e7f7-49c4-85ea-8cf403acaaf1
╷
│ Warning: Argument is deprecated
│ 
│   with aws_elasticache_replication_group.primary,
│   on backend.tf line 85, in resource "aws_elasticache_replication_group" "primary":
│   85:   replication_group_description = "Primary replication group"
│ 
│ Use description instead
│ 
│ (and 6 more similar warnings elsewhere)
╵
╷
│ Error: error creating ElastiCache Replication Group (frontend-poc-us-redis-secondary-rg): InvalidParameterCombination: Cannot use the given parameters when creating new replication group in an existing global replication group.
│       status code: 400, request id: 93343807-e7f7-49c4-85ea-8cf403acaaf1
│ 
│   with aws_elasticache_replication_group.secondary,
│   on frontend.tf line 149, in resource "aws_elasticache_replication_group" "secondary":
│  149: resource "aws_elasticache_replication_group" "secondary" {
│ 
╵
2022-05-18T16:28:16.158+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2022-05-18T16:28:16.162+0200 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/aws/4.14.0/darwin_arm64/terraform-provider-aws_v4.14.0_x5 pid=89300
2022-05-18T16:28:16.164+0200 [DEBUG] provider: plugin exited

Panic Output

Expected Behavior

Expected to successfully create following resources:

  • Primary replication group in default provider
  • Global replication group in default provider
  • Secondary replication group in frontend provider

Actual Behavior

Creation of Secondary replication group fails with error InvalidParameterCombination Cannot use the given parameters when creating new replication group in an existing global replication group. because the provider is sending following in query string Action=CreateReplicationGroup&AutoMinorVersionUpgrade=true&GlobalReplicationGroupId=iudkw-backend-poc&ReplicationGroupDescription=Secondary+replication+group&ReplicationGroupId=frontend-poc-us-redis-secondary-rg&Version=2015-02-02 which contains AutoMinorVersionUpgrade=true that actually causes conflicting error, even tho this was never explicitly defined in the actual resource.

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000

aleksandar-babic avatar May 18 '22 14:05 aleksandar-babic

Note that the same problem happens in cluster mode (with GDS too).

ncheutin avatar May 19 '22 12:05 ncheutin

The same problem, but we use 3.74.3 of the AWS provider. So weird, because nothing changed in our terraform code, it deployed a hundred times with the same settings, and now we got this issue.

OuFinx avatar May 25 '22 08:05 OuFinx

The same problem, but we use 3.74.3 of the AWS provider. So weird, because nothing changed in our terraform code, it deployed a hundred times with the same settings, and now we got this issue.

Agreed, I tried setting AWS provider version that I last used to do this exact same kind of deployment (with same code) and it wasn't working anymore.

ncheutin avatar May 25 '22 08:05 ncheutin

We are experiencing the same problem. Is there any progress in the bug(?) above?

dable-kimbawoo avatar May 27 '22 02:05 dable-kimbawoo

Facing same issue while creating a secondary instance in a global datastore, always get this message regardless of combination: InvalidParameterCombination: Cannot use the given parameters when creating new replication group in an existing global replication group. update: not working from terraform, provider aws~4.2.0, but works if you create from AWS UI.

SimranSingh17 avatar May 27 '22 05:05 SimranSingh17

I'm facing the same issue. However, the same values that I have defined in terraform do work in the cli and AWS Console.

dnoji avatar May 27 '22 06:05 dnoji

@SimranSingh17 We are experiencing exactly the same problem

dable-kimbawoo avatar May 27 '22 07:05 dable-kimbawoo

Anyone found a way to fix this?

SimranSingh17 avatar May 31 '22 07:05 SimranSingh17

reproducible in version 3.74.0

ccatari-sweet avatar May 31 '22 14:05 ccatari-sweet

I can confirm that any combination of variables results in the behavior stated above. Furthermore, if you create the replication group in the UI and then import it into terraform, it results in a InvalidGlobalReplicationGroupState error on a subsequent apply. For now, we're using terraform to manage the aws_elasticache_global_replication_group itself, while just managing the secondary cluster out-of-band until the bug is fixed.

psaia avatar Jun 06 '22 13:06 psaia

This was resolved for me with aws provider version 4.18.0. (I received this error in 4.8.0 version of aws provider). Give it a try with 4.18.0

Rustege avatar Jun 13 '22 12:06 Rustege

Can confirm with @Rustege this bare minimum setup that met our needs, we were able to create the secondary replica cluster without the InvalidParameterCombination error with version 4.18.0 AWS Provider:


resource "aws_elasticache_replication_group" "secondary" {
  replication_group_id        = "some-redis-replica"
  description                 = "secondary replication group"
  global_replication_group_id = data.terraform_remote_state.primary_redis.outputs.global_replication_group_id
  subnet_group_name           = aws_elasticache_subnet_group.redis.name
  security_group_ids          = [aws_security_group.redis.id]

  lifecycle {
    ignore_changes = [engine_version]
  }
}

vinfang avatar Jun 14 '22 05:06 vinfang

Hello everyone. I cannot reproduce the error described here. Are you still seeing the error on recent versions of the provider? If so, which version(s)?

gdavison avatar Jul 05 '22 02:07 gdavison

Hi

I was able to reprofuce from version 3.74 to 4.14

Best Regards Carlos

On Mon, Jul 4, 2022, 22:22 Graham Davison @.***> wrote:

Hello everyone. I cannot reproduce the error described here. Are you still seeing the error on recent versions of the provider? If so, which version(s)?

— Reply to this email directly, view it on GitHub https://github.com/hashicorp/terraform-provider-aws/issues/24854#issuecomment-1174531147, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZEQ66JXECW2Y4JAY6TYUGDVSOL5XANCNFSM5WIWWVUA . You are receiving this because you commented.Message ID: @.***>

ccatari-sweet avatar Jul 05 '22 04:07 ccatari-sweet

is it possible to request the AWS provider provide better output on what parameters are invalid for the InvalidParameterCombination error?

vinfang avatar Jul 07 '22 19:07 vinfang

Hi,

Still doesn't work with 4.14.

Here is the config if that helps to reproduce:

  # aws_elasticache_global_replication_group.redis_global_datastore["green"] will be created
  + resource "aws_elasticache_global_replication_group" "redis_global_datastore" {
      + arn                                = (known after apply)
      + at_rest_encryption_enabled         = (known after apply)
      + auth_token_enabled                 = (known after apply)
      + cache_node_type                    = (known after apply)
      + cluster_enabled                    = (known after apply)
      + engine                             = (known after apply)
      + engine_version_actual              = (known after apply)
      + global_replication_group_id        = (known after apply)
      + global_replication_group_id_suffix = "decision-engine-green"
      + id                                 = (known after apply)
      + primary_replication_group_id       = (known after apply)
      + transit_encryption_enabled         = (known after apply)
    }

  # module.cluster_primary["green"].aws_elasticache_replication_group.redis-cache will be created
  + resource "aws_elasticache_replication_group" "redis-cache" {
      + apply_immediately              = true
      + arn                            = (known after apply)
      + at_rest_encryption_enabled     = (known after apply)
      + auto_minor_version_upgrade     = "true"
      + automatic_failover_enabled     = true
      + cluster_enabled                = (known after apply)
      + configuration_endpoint_address = (known after apply)
      + data_tiering_enabled           = (known after apply)
      + description                    = "Decision Engine Redis green Cache"
      + engine                         = "redis"
      + engine_version                 = "5.0.6"
      + engine_version_actual          = (known after apply)
      + global_replication_group_id    = (known after apply)
      + id                             = (known after apply)
      + maintenance_window             = (known after apply)
      + member_clusters                = (known after apply)
      + multi_az_enabled               = true
      + node_type                      = "cache.r6g.xlarge"
      + num_cache_clusters             = (known after apply)
      + num_node_groups                = 1
      + number_cache_clusters          = (known after apply)
      + parameter_group_name           = "default.redis5.0.cluster.on"
      + port                           = 6379
      + primary_endpoint_address       = (known after apply)
      + reader_endpoint_address        = (known after apply)
      + replicas_per_node_group        = 2
      + replication_group_description  = (known after apply)
      + replication_group_id           = "decision-engine-green-test"
      + security_group_ids             = (known after apply)
      + security_group_names           = (known after apply)
      + snapshot_retention_limit       = 1
      + snapshot_window                = "10:00-12:00"
      + subnet_group_name              = "decision-engine-green-subnet-group-test-us-west-2"
      + tags                           = {
          + "Terraform"            = "true"
        }
      + tags_all                       = {
          + "Terraform"            = "true"
        }
      + transit_encryption_enabled     = (known after apply)

      + cluster_mode {
          + num_node_groups         = (known after apply)
          + replicas_per_node_group = (known after apply)
        }
    }

  # module.cluster_secondary["green"].aws_elasticache_replication_group.redis-cache will be created
  + resource "aws_elasticache_replication_group" "redis-cache" {
      + apply_immediately              = false
      + arn                            = (known after apply)
      + at_rest_encryption_enabled     = (known after apply)
      + auto_minor_version_upgrade     = "true"
      + automatic_failover_enabled     = true
      + cluster_enabled                = (known after apply)
      + configuration_endpoint_address = (known after apply)
      + data_tiering_enabled           = (known after apply)
      + description                    = "Decision Engine secondary green Cache"
      + engine                         = "redis"
      + engine_version                 = (known after apply)
      + engine_version_actual          = (known after apply)
      + global_replication_group_id    = (known after apply)
      + id                             = (known after apply)
      + maintenance_window             = (known after apply)
      + member_clusters                = (known after apply)
      + multi_az_enabled               = true
      + node_type                      = (known after apply)
      + num_cache_clusters             = (known after apply)
      + num_node_groups                = (known after apply)
      + number_cache_clusters          = (known after apply)
      + parameter_group_name           = (known after apply)
      + port                           = 6379
      + primary_endpoint_address       = (known after apply)
      + reader_endpoint_address        = (known after apply)
      + replicas_per_node_group        = 2
      + replication_group_description  = (known after apply)
      + replication_group_id           = "decision-engine-green-test"
      + security_group_ids             = (known after apply)
      + security_group_names           = (known after apply)
      + snapshot_retention_limit       = 1
      + snapshot_window                = "10:00-12:00"
      + subnet_group_name              = "decision-engine-green-subnet-group-test-us-east-1"
      + tags                           = {
          + "Terraform"            = "true"
        }
      + tags_all                       = {
          + "Terraform"            = "true"
        }
      + transit_encryption_enabled     = (known after apply)

      + cluster_mode {
          + num_node_groups         = (known after apply)
          + replicas_per_node_group = (known after apply)
        }
    }

Cheers, Nico

ncheutin avatar Jul 14 '22 11:07 ncheutin

We tested the code with minimal viable parameters and even with provider 4.18.0 and still seeing this error. Do any one have consistent success with latest provider?

blvinod avatar Aug 09 '22 18:08 blvinod

Hai, We are facing the same issue on hashicorp/aws v4.29.0 version. Here is the config if that helps to reproduce:

aws_elasticache_replication_group.secondary will be created

  • resource "aws_elasticache_replication_group" "secondry" {
    • apply_immediately = (known after apply)

    • arn = (known after apply)

    • at_rest_encryption_enabled = (known after apply)

    • auto_minor_version_upgrade = true

    • automatic_failover_enabled = false

    • cluster_enabled = (known after apply)

    • configuration_endpoint_address = (known after apply)

    • data_tiering_enabled = (known after apply)

    • description = "secondary replication group"

    • engine = "redis"

    • engine_version = (known after apply)

    • engine_version_actual = (known after apply)

    • global_replication_group_id = "ldgnf-test-global-cy-cyogesh"

    • id = (known after apply)

    • maintenance_window = (known after apply)

    • member_clusters = (known after apply)

    • multi_az_enabled = false

    • node_type = (known after apply)

    • num_cache_clusters = 1

    • num_node_groups = (known after apply)

    • number_cache_clusters = (known after apply)

    • parameter_group_name = (known after apply)

    • port = 6379

    • primary_endpoint_address = (known after apply)

    • reader_endpoint_address = (known after apply)

    • replicas_per_node_group = (known after apply)

    • replication_group_description = (known after apply)

    • replication_group_id = "example-secondary"

    • security_group_ids = (known after apply)

    • security_group_names = (known after apply)

    • snapshot_retention_limit = 1

    • snapshot_window = "10:00-12:00"

    • subnet_group_name = (known after apply)

    • transit_encryption_enabled = (known after apply)

    • cluster_mode {

      • num_node_groups = (known after apply)
      • replicas_per_node_group = (known after apply) } }

Regards Yogesh Chandrakanth

yogesh2580 avatar Sep 22 '22 10:09 yogesh2580

i just tried version 4.33.0 and it works. it was failing for me before (4.12.1). my global-datasore and both primary and secondary are new clusters. i have the basic setup right now -

 resource "aws_elasticache_global_replication_group" "elasticache_global" {
   global_replication_group_id_suffix = "preprod-test-elasticache-01"
   primary_replication_group_id       = aws_elasticache_replication_group.primary.id
 }

 resource "aws_elasticache_replication_group" "primary" {
   replication_group_id = "preprod-test-elasticache-01-us-east-2"
   description          = "primary replication group"

   engine               = "redis"
   engine_version       = "6.2"
   node_type            = "cache.m6g.large"

   auto_minor_version_upgrade = true

   num_cache_clusters   = 2
 }

 resource "aws_elasticache_replication_group" "secondary" {
   provider                    = aws.oregon

   replication_group_id        = "preprod-test-elasticache-01-us-west-2"
   description                 = "secondary replication group"
   global_replication_group_id = aws_elasticache_global_replication_group.elasticache_global.global_replication_group_id

   num_cache_clusters          = 1
 }

apply -

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # aws_elasticache_global_replication_group.elasticache_global will be created
  + resource "aws_elasticache_global_replication_group" "elasticache_global" {
      + arn                                = (known after apply)
      + at_rest_encryption_enabled         = (known after apply)
      + auth_token_enabled                 = (known after apply)
      + cache_node_type                    = (known after apply)
      + cluster_enabled                    = (known after apply)
      + engine                             = (known after apply)
      + engine_version                     = (known after apply)
      + engine_version_actual              = (known after apply)
      + global_replication_group_id        = (known after apply)
      + global_replication_group_id_suffix = "preprod-test-elasticache-01"
      + id                                 = (known after apply)
      + primary_replication_group_id       = (known after apply)
      + transit_encryption_enabled         = (known after apply)
    }

  # aws_elasticache_replication_group.primary will be created
  + resource "aws_elasticache_replication_group" "primary" {
      + apply_immediately              = (known after apply)
      + arn                            = (known after apply)
      + at_rest_encryption_enabled     = (known after apply)
      + auto_minor_version_upgrade     = "true"
      + automatic_failover_enabled     = false
      + cluster_enabled                = (known after apply)
      + configuration_endpoint_address = (known after apply)
      + data_tiering_enabled           = (known after apply)
      + description                    = "primary replication group"
      + engine                         = "redis"
      + engine_version                 = "6.2"
      + engine_version_actual          = (known after apply)
      + global_replication_group_id    = (known after apply)
      + id                             = (known after apply)
      + maintenance_window             = (known after apply)
      + member_clusters                = (known after apply)
      + multi_az_enabled               = false
      + node_type                      = "cache.m6g.large"
      + num_cache_clusters             = 2
      + num_node_groups                = (known after apply)
      + number_cache_clusters          = (known after apply)
      + parameter_group_name           = (known after apply)
      + primary_endpoint_address       = (known after apply)
      + reader_endpoint_address        = (known after apply)
      + replicas_per_node_group        = (known after apply)
      + replication_group_description  = (known after apply)
      + replication_group_id           = "preprod-test-elasticache-01-us-east-2"
      + security_group_ids             = (known after apply)
      + security_group_names           = (known after apply)
      + snapshot_window                = (known after apply)
      + subnet_group_name              = (known after apply)
      + tags_all                       = (known after apply)
      + transit_encryption_enabled     = (known after apply)

      + cluster_mode {
          + num_node_groups         = (known after apply)
          + replicas_per_node_group = (known after apply)
        }
    }

  # aws_elasticache_replication_group.secondary will be created
  + resource "aws_elasticache_replication_group" "secondary" {
      + apply_immediately              = (known after apply)
      + arn                            = (known after apply)
      + at_rest_encryption_enabled     = (known after apply)
      + auto_minor_version_upgrade     = (known after apply)
      + automatic_failover_enabled     = false
      + cluster_enabled                = (known after apply)
      + configuration_endpoint_address = (known after apply)
      + data_tiering_enabled           = (known after apply)
      + description                    = "secondary replication group"
      + engine                         = "redis"
      + engine_version                 = (known after apply)
      + engine_version_actual          = (known after apply)
      + global_replication_group_id    = (known after apply)
      + id                             = (known after apply)
      + maintenance_window             = (known after apply)
      + member_clusters                = (known after apply)
      + multi_az_enabled               = false
      + node_type                      = (known after apply)
      + num_cache_clusters             = 1
      + num_node_groups                = (known after apply)
      + number_cache_clusters          = (known after apply)
      + parameter_group_name           = (known after apply)
      + primary_endpoint_address       = (known after apply)
      + reader_endpoint_address        = (known after apply)
      + replicas_per_node_group        = (known after apply)
      + replication_group_description  = (known after apply)
      + replication_group_id           = "preprod-test-elasticache-01-us-west-2"
      + security_group_ids             = (known after apply)
      + security_group_names           = (known after apply)
      + snapshot_window                = (known after apply)
      + subnet_group_name              = (known after apply)
      + tags_all                       = (known after apply)
      + transit_encryption_enabled     = (known after apply)

      + cluster_mode {
          + num_node_groups         = (known after apply)
          + replicas_per_node_group = (known after apply)
        }
    }

Plan: 3 to add, 0 to change, 0 to destroy.
...
Apply complete! Resources: 3 added, 0 changed, 0 destroyed.

re-run with minor changes -

Terraform will perform the following actions:

  # aws_elasticache_replication_group.primary will be updated in-place
  ~ resource "aws_elasticache_replication_group" "primary" {
      + apply_immediately             = true
      ~ auto_minor_version_upgrade    = "false" -> "true"
        id                            = "preprod-test-elasticache-01-us-east-2"
      ~ tags                          = {
          + "infra" = "terraform"
        }
      ~ tags_all                      = {
          + "infra" = "terraform"
        }
        # (31 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

  # aws_elasticache_replication_group.secondary will be updated in-place
  ~ resource "aws_elasticache_replication_group" "secondary" {
      + apply_immediately             = true
      ~ auto_minor_version_upgrade    = "false" -> "true"
        id                            = "preprod-test-elasticache-01-us-west-2"
      ~ member_clusters               = [
          - "preprod-test-elasticache-01-us-west-2-001",
        ] -> (known after apply)
      ~ num_cache_clusters            = 1 -> 2
      ~ tags                          = {
          + "infra" = "terraform"
        }
      ~ tags_all                      = {
          + "infra" = "terraform"
        }
        # (29 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 2 to change, 0 to destroy.
...
Error: error updating ElastiCache Replication Group (preprod-test-elasticache-01-us-east-2): InvalidParameterValue: Cluster [preprod-test-elasticache-01-us-east-2] is part of a global cluster [fpkhr-preprod-test-elasticache-01]. Request rejected.
...
Error: error updating ElastiCache Replication Group (preprod-test-elasticache-01-us-west-2): InvalidParameterValue: Cluster [preprod-test-elasticache-01-us-west-2] is part of a global cluster [fpkhr-preprod-test-elasticache-01]. Request rejected.

2nd apply not so good. :-\

AH!!! looks like by auto_minor_version_upgrade tries to set to true every apply which causes the issue above, i ended up ignoring with lifecycle -

  lifecycle {
    prevent_destroy = true
    ignore_changes = [
      auto_minor_version_upgrade,
    ]
  }

... then it works fine...

cwong-archy avatar Oct 06 '22 00:10 cwong-archy

is it possible to request the AWS provider provide better output on what parameters are invalid for the InvalidParameterCombination error?

That is an error message from the AWS API, so unfortunately we have no control over it. We try to configure plan-time validation for resources, but sometime we miss some cases.

gdavison avatar Mar 01 '23 01:03 gdavison

@aleksandar-babic, are you still seeing this error with updated versions of the provider?

gdavison avatar Mar 01 '23 01:03 gdavison

For the 3.70.0 provider version, we tried the same configuration as documented by Terraform in provider version 3.70.0 and faced the same issue of InvalidParameterCombination, but when the same configuration was tried using version 4.15.0, it worked fine. 

resource "aws_elasticache_replication_group" "secondary" {
  replication_group_id          = "example-secondary"
  replication_group_description = "secondary replication group"
  global_replication_group_id   = aws_elasticache_global_replication_group.example.global_replication_group_id

  number_cache_clusters = 1
}

resource "aws_elasticache_global_replication_group" "example" {
  provider = aws.other_region

  global_replication_group_id_suffix = "example"
  primary_replication_group_id       = aws_elasticache_replication_group.primary.id
}

resource "aws_elasticache_replication_group" "primary" {
  provider = aws.other_region

  replication_group_id          = "example-primary"
  replication_group_description = "primary replication group"

  engine         = "redis"
  engine_version = "5.0.6"
  node_type      = "cache.m5.large"

  number_cache_clusters = 1
} 

Is this issue completely resolved in provider version 4.15.0?

ccsandhanshive avatar Apr 17 '23 10:04 ccsandhanshive

we're running into the same issue and the provider version is 4.67.0 and still running into the same problem, we added the lifecycle ignore section as mentioned in one of the comments above, but no luck. Do you have any other suggestions?

patelpayal avatar Jun 22 '23 22:06 patelpayal

Having same issue. I've tried all the workarounds that I found but without any progress. Same error is returned. I have tried the code that is provided as example here https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticache_replication_group.html and I got same error. Could you please help? I'm using 4.2.0 provider version

gogutza2 avatar Aug 30 '23 15:08 gogutza2