Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws_elasticache_replication_group fails to add, modify, delete tags on existing resource #1615

Closed
httpstergeek opened this issue Sep 7, 2017 · 9 comments
Labels
bug Addresses a defect in current functionality. service/elasticache Issues and PRs that pertain to the elasticache service.

Comments

@httpstergeek
Copy link

Terraform Version

Terraform v0.10.3

Affected Resource(s)

AWS Provider

  • aws_elasticache_replication_group

Terraform Configuration Files

 #original
  resource "aws_elasticache_replication_group" "redis" {
      replication_group_id          = "bmcachetest"
      replication_group_description = "${module.tags.name_prefix}cache"
      node_type                     = "${var.node_type}"
      port                          = 6379
      parameter_group_name          = "${aws_elasticache_parameter_group.redis.name}"
      automatic_failover_enabled    = true
      subnet_group_name             = "${var.cache_subnet_group}"
      security_group_ids            = ["${data.aws_security_group.redis_sg.id}"]
      maintenance_window            = "sun:09:00-sun:11:00" # UTC

      cluster_mode {
          replicas_per_node_group     = 1
          num_node_groups             = 2
      }
  }

Original aws_elasticache_replication_group is created without tags with no tags. Resource is then updated with tags.

 # Updated resource
  resource "aws_elasticache_replication_group" "redis" {
      replication_group_id          = "bmcachetest"
      replication_group_description = "${module.tags.name_prefix}cache"
      node_type                     = "${var.node_type}"
      port                          = 6379
      parameter_group_name          = "${aws_elasticache_parameter_group.redis.name}"
      automatic_failover_enabled    = true
      subnet_group_name             = "${var.cache_subnet_group}"
      security_group_ids            = ["${data.aws_security_group.redis_sg.id}"]
      maintenance_window            = "sun:09:00-sun:11:00" # UTC

      cluster_mode {
          replicas_per_node_group     = 1
          num_node_groups             = 2
      }

      tags {
          Owner       = "${module.tags.owner}"
          Service     = "${module.tags.service}"
          Team        = "${module.tags.team}"
          Environment = "${module.tags.environment}"
          Description = "${module.tags.description}"
          Terraform   = "${path.root}"
          autoFailover = "${var.autoFailover}"
          Slack       = "${var.slack_channel}"
      }
  }

Terraform output

aws_elasticache_parameter_group.redis: Refreshing state... (ID: bm-redis-params)
data.aws_security_group.redis_sg: Refreshing state...
aws_elasticache_replication_group.redis: Refreshing state... (ID: bmcachetest)
module.service.aws_elasticache_replication_group.redis: Modifying... (ID: bmcachetest)
  tags.%:            "0" => "8"
  tags.Description:  "" => "userstore cacheops"
  tags.Environment:  "" => "test"
  tags.Owner:        "" => "ops@group.com"
  tags.Service:      "" => "userstoreops"
  tags.Slack:        "" => "homerecs-jobs-devs"
  tags.Team:         "" => "ops"
  tags.Terraform:    "" => "/Users/bm/git/terraform-scripts/services/aws/userstore/test"
  tags.autoFailover: "" => "true"

module.service.aws_elasticache_replication_group.redis: Modifications complete after 0s (ID: bmcachetest)

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

Expected Behavior

When updating an aws_elasticache_replication_group existing tags or with new tags node associated with replication group will modify, add, or delete.

Actual Behavior

When updating an aws_elasticache_replication_group tags are not updated. Terraform state is updated with new tags however tags are not updated on nodes associated with replication group.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. Create an aws_elasticache_parameter_group with or without tags
  2. terraform apply
  3. Update aws_elasticache_parameter_group resource with tags.
  4. terraform apply
  5. inspect tags on aws_elasticache_parameter_group

Factoid

Tags are correctly applied only during creation of resource.

@Ninir Ninir added the bug Addresses a defect in current functionality. label Sep 18, 2017
@radeksimko radeksimko added the service/elasticache Issues and PRs that pertain to the elasticache service. label Jan 28, 2018
@asf-stripe
Copy link

asf-stripe commented Apr 9, 2018

I'm seeing the same: On replication group creation, tags are applied to all replicas; Changing tags on an existing replication group doesn't work.

Defining replicas using resource "aws_elasticache_cluster" "replica" and assigning tags in that replica's block doesn't change tags on an existing replication group's replicas (even those defined with the replica resource) either.

@joelvanvelden
Copy link

I can confirm this bug is still present in 1.31.0 😞

@donglaizhang
Copy link

Hey, This bug is still there in Terraform v0.11.8 and provider.aws v1.39.0.

@AliBazzi
Copy link

AliBazzi commented Oct 9, 2018

+1

@varknull
Copy link

experiencing the same issue with provider.aws v1.40

@shuqichen
Copy link

This bug still exists when I try to update tags for the node of aws_elasticache_replication_group:
apply success, but tags are not updated in AWS:
Resource actions are indicated with the following symbols:
~ update in-place

Terraform will perform the following actions:

~ module.redis.aws_elasticache_replication_group.tr-redis-repl
tags.%: "6" => "7"
tags.adsk:moniker: "" => "TR-S-UE1"
tags.adsk:service: "AWS-TR-STAGING" => "AWS-TR-STAGE"

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.redis.aws_elasticache_replication_group.tr-redis-repl: Modifying... (ID: tr-redis-repl)
tags.%: "6" => "7"
tags.adsk:moniker: "" => "TR-S-UE1"
tags.adsk:service: "AWS-TR-STAGING" => "AWS-TR-STAGE"
module.redis.aws_elasticache_replication_group.tr-redis-repl: Modifications complete after 5s (ID: tr-redis-repl)

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

version info:
C02VVAHYHTD6:stage chenshu$ terraform -version
Terraform v0.11.11

  • provider.aws v1.54.0
  • provider.template v1.0.0

@raz-canva
Copy link

Any progress on this?

@ryndaniels
Copy link
Contributor

Hi @httpstergeek - we've looked into this further, and the ability to modify tags in replication group members is not supported by the AWS API. As a general rule, we are only able to commit to providing functionality in Terraform that maps to what is supported by the underlying APIs, so the ability to modify tags in Terraform isn't something that we plan to add at this point.

@ghost
Copy link

ghost commented Nov 1, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@hashicorp hashicorp locked and limited conversation to collaborators Nov 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/elasticache Issues and PRs that pertain to the elasticache service.
Projects
None yet
Development

No branches or pull requests