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

DynamoDB Global Table Version 2 Replicas don't propagate tags to replica #13281

Closed
whume opened this issue May 12, 2020 · 4 comments · Fixed by #25866
Closed

DynamoDB Global Table Version 2 Replicas don't propagate tags to replica #13281

whume opened this issue May 12, 2020 · 4 comments · Fixed by #25866
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/dynamodb Issues and PRs that pertain to the dynamodb service.
Milestone

Comments

@whume
Copy link

whume commented May 12, 2020

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

Description

A switch should be added to the dynamodb replica to propagate tags over to the replica table. Currently the tagging option is available in the UI but tags are empty after creation of a replica.

New or Affected Resource(s)

"aws_dynamodb_table"

Potential Terraform Configuration

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.
resource "aws_dynamodb_table" "dynamodb_table" {
  replica {
    region_name = "us-east-2"
    propagate_tags = true
  }
}

References

  • #0000
@whume whume added the enhancement Requests to existing resources that expand the functionality or scope. label May 12, 2020
@ghost ghost added the service/dynamodb Issues and PRs that pertain to the dynamodb service. label May 12, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label May 12, 2020
@breathingdust breathingdust removed the needs-triage Waiting for first response or review from a maintainer. label Sep 22, 2021
@ewbankkit
Copy link
Contributor

This can be achieved using the aws_dynamodb_tag resource:

For example, something like:

provider "aws" {
  region = "us-east-1"
}

provider "awsalternate" {
  region = "us-west-2"
}

data "aws_region" "alternate" {
  provider = "awsalternate"
}

data "aws_region" "current" {}

resource "aws_dynamodb_table" "test" {
  provider = "awsalternate"

  billing_mode     = "PAY_PER_REQUEST"
  hash_key         = "TestTableHashKey"
  name             = %[1]q
  stream_enabled   = true
  stream_view_type = "NEW_AND_OLD_IMAGES"

  attribute {
    name = "TestTableHashKey"
    type = "S"
  }

  replica {
    region_name = data.aws_region.current.name
  }
}

# Set the tag on the replica.
resource "aws_dynamodb_tag" "test" {
  resource_arn = replace(aws_dynamodb_table.test.arn, data.aws_region.alternate.name, data.aws_region.current.name)
  key          = "testkey"
  value        = "testvalue"
}

@ewbankkit
Copy link
Contributor

ewbankkit commented May 18, 2022

Use of the aws_dynamodb_tag may not be a suitable solution if the AWS Regions are dynamically determined (and so would use the for_each syntax to configure the replica blocks) and Terraform modules are used.

We could add a tags argument into the replica block, e.g.

resource "aws_dynamodb_table" "test" {
  ...

  replica {
    region_name = "us-east-1"

    tags = {
      Usage = "Primary"
    }
  }

  replica {
    region_name = "us-east-2"

    tags = {
      Usage = "Secondary"
    }
  }
}

and document carefully that this would conflict with use of the aws_dynamodb_tags resource.

@github-actions
Copy link

This functionality has been released in v4.23.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/dynamodb Issues and PRs that pertain to the dynamodb service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants