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 table replica support #83

Merged
merged 8 commits into from
Apr 30, 2021

Conversation

mwarkentin
Copy link
Sponsor Contributor

what

  • This feature will allow setting replica configurations for aws_dynamodb_table resource.

why

  • According to the note at AWS provider v3.4.0 docs, it's recommended to use replica configuration instead of aws_dynamodb_global_table resource and there is a lack of that functionality in this module.

references

@mwarkentin mwarkentin requested review from a team as code owners April 29, 2021 13:41
@SweetOps
Copy link

/test all

@mwarkentin
Copy link
Sponsor Contributor Author

FYI, I haven't tested these changes myself yet, working on getting a terraform 0.13 environment set up to test (we're in the middle of upgrading from 12 -> 13 right now).

main.tf Outdated Show resolved Hide resolved
Co-authored-by: Vladimir <vladimir.fess@gmail.com>
@SweetOps
Copy link

/test all

stream_enabled = var.enable_streams
stream_view_type = var.enable_streams ? var.stream_view_type : ""
stream_enabled = length(var.replicas) > 0 ? true : var.enable_streams
stream_view_type = length(var.replicas) > 0 || var.enable_streams ? var.stream_view_type : ""
Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe for global tables stream_view_type needs to be NEW_AND_OLD_IMAGES - is that something we want to configure automatically or just document and expect the user to pass in?

@mwarkentin
Copy link
Sponsor Contributor Author

mwarkentin commented Apr 29, 2021

Looks like there's some billing_mode requirements as well:

Error: error initially creating DynamoDB Table (wave-devmw-multi-region) replicas: error creating DynamoDB Table (wave-devmw-multi-region) replica (us-east-2): ValidationException: Table write capacity should either be Pay-Per-Request or AutoScaled.

Edit: looks like there's an open issue for this: hashicorp/terraform-provider-aws#13097

Edit 2: Can create from scratch without an issue when using billing_mode = "PAY_PER_REQUEST":
image

@mwarkentin
Copy link
Sponsor Contributor Author

/test all

@mwarkentin
Copy link
Sponsor Contributor Author

@SweetOps ready for another look whenever you're around. I've tested:

  • DynamoDB tables creation works in both single-region and multi-region mode (with a caveat)
  • Single-region table can be converted to multi-region, and back again

@SweetOps
Copy link

/test all

@SweetOps
Copy link

/test all

@SweetOps SweetOps merged commit f20b54a into cloudposse:master Apr 30, 2021
@mwarkentin mwarkentin deleted the dynamodb-table-replica-support branch April 30, 2021 14:12
@mwarkentin
Copy link
Sponsor Contributor Author

@SweetOps thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Global Table regions
3 participants