terraform-aws-documentdb-cluster icon indicating copy to clipboard operation
terraform-aws-documentdb-cluster copied to clipboard

Add support for copy_tags_to_snapshot in aws_docdb_cluster_instance resource

Open hassanzhd opened this issue 2 years ago • 3 comments

Describe the Feature

Please add support for copy_tags_to_snapshot argument in aws_docdb_cluster_instance resource so that tags are copied to snapshots created for documentdb clusters

Expected Behavior

There is no support for copy_tags_to_snapshot argument in aws_docdb_cluster_instance resource which was added by AWS in version 5.21.0.

Use Case

The reason why we need this is because, snapshots generated for document_db clusters are untagged which in our case needs to be same as the ones provided on cluster_instance

Describe Ideal Solution

Update the resource as follows:

resource "aws_docdb_cluster_instance" "default" {
  count                        = module.this.enabled ? var.cluster_size : 0
  identifier                   = "${module.this.id}-${count.index + 1}"
  cluster_identifier           = join("", aws_docdb_cluster.default[*].id)
  apply_immediately            = var.apply_immediately
  preferred_maintenance_window = var.preferred_maintenance_window
  instance_class               = var.instance_class
  engine                       = var.engine
  auto_minor_version_upgrade   = var.auto_minor_version_upgrade
  enable_performance_insights  = var.enable_performance_insights
  ca_cert_identifier           = var.ca_cert_identifier
  tags                         = module.this.tags
  copy_tags_to_snapshot =  true
}

Alternatives Considered

No response

Additional Context

No response

hassanzhd avatar Nov 28 '23 09:11 hassanzhd

We're experiencing the same problem where our defined instance has copy_tags_to_snapshot but the cluster itself doesn't respect this when creating the snapshots - definitely seems like a bug.

@hassanzhd, did you ever find a workaround for this?

edfui avatar Sep 06 '24 09:09 edfui

@edfui as far as i remember, we switched to https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/docdb_cluster_instance and it worked

hassanzhd avatar Sep 06 '24 12:09 hassanzhd

This is sad :(

Shashwatpathak05 avatar Oct 03 '24 07:10 Shashwatpathak05