-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Secrets Manager: Support Secret Replication #17943
Comments
Worth mentioning support for this was added into the |
I took a look at implementing this but have run into an issue with the API. Here's my proposed TF config: resource "aws_secretsmanager_replication" "example" {
secret_id = aws_secretsmanger_secret.example.id
add_replica_regions {
region = "us-east-1"
kms_key_id = aws_kms_key.example.id
}
force_overwrite_replica_secret = false The problem I've got is that |
Just a naming thing: aws_dynamodb_table has a similar replica {
region_name = "us-east-2"
} |
@TomTucka Pardon my ignorance, but I know secrets allows for multiple replications, does your configuration block allow for that? i.e. replication_configuration {
force_overwrite_replica_secret = false
replica_region {
region = "us-east-1"
kms_key_id = aws_kms_key.example.id
}
replica_region {
region = "us-west-2"
kms_key_id = "alias/foo"
}
} Thanks for your work on this! This feature will help me out biiiiigggg time! |
Hey @mpescetto, It will do yes! |
Any news?! Today, I'm implementing using resource "null_resource" "multi-region" {
provisioner "local-exec" {
command = "aws secretsmanager replicate-secret-to-regions --secret-id ${aws_secretsmanager_secret.secret.id} --force-overwrite-replica-secret --add-replica-regions \"Region=${var.ssm-replicate-region}\""
}
depends_on = [
aws_secretsmanager_secret.secret
]
} |
In the meantime, I've created a module that simulates the |
I enhanced @thiagolsfortunato work around. I have the below in a "secret" module, with an input argument of This will destroy the replicated secret if the region list changes.
|
@bdriggs-axian This requires having default credentials set for AWS on the CLI though right? That often doesn't work if multiple developers work on it, if it's being run in Terraform Cloud, if the Terraform files manage multiple AWS accounts (organization accounts), etc. Not to mention it also requires having the AWS CLI installed, which isn't always the case either. Unless I'm missing something, I don't see why using a CloudFormation resource wouldn't be preferable. |
This functionality has been released in v3.52.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! |
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. |
Community Note
Description
AWS has launched support for replicating secrets between regions. We should add the ability to configure this in Terraform
New or Affected Resource(s)
References
The text was updated successfully, but these errors were encountered: