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

New resource: aws_kms_multi_region_key to define both primary and replica keys #22243

Closed
lnattrass opened this issue Dec 15, 2021 · 5 comments
Closed
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/kms Issues and PRs that pertain to the kms service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.

Comments

@lnattrass
Copy link

lnattrass commented Dec 15, 2021

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

aws_secretsmanager_secret allows you to specify regions to replicate secrets to within the resource itself.

aws_kms_replica_key does not follow this pattern, even though the API call is made against the Primary key's region.

Given it's not possible to for_each over providers, I think makes sense to support specifying additional regions without having to instantiate a new provider in the target region.

New or Affected Resource(s)

  • aws_kms_replica_key

Potential Terraform Configuration

resource "aws_kms_key" "primary" {
  description             = "Multi-Region primary key"
  deletion_window_in_days = 30
  multi_region            = true
}

resource "aws_kms_replica_key" "replica" {
  description             = "Multi-Region replica key"
  deletion_window_in_days = 7
  primary_key_arn         = aws_kms_key.primary.arn
  region = "us-west-2"
}

or this:

resource "aws_kms_key" "mrk" {
  description             = "Multi-Region primary key"
  deletion_window_in_days = 30
  multi_region            = true
  replica {
    region = "us-west-2"
  }
}

References

  • #0000
@lnattrass lnattrass added the enhancement Requests to existing resources that expand the functionality or scope. label Dec 15, 2021
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/kms Issues and PRs that pertain to the kms service. labels Dec 15, 2021
@ewbankkit
Copy link
Contributor

@lnattrass Please see this comment about the possibility of adding a aws_kms_multi_region_key (or similar) resource which would encapsulate the primary and replica keys of a multi-region KMS key.
If that idea sounds right, please re-title this PR and we can use it to gather upvotes and comments.

@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Dec 15, 2021
@lnattrass lnattrass changed the title Can aws_kms_replica_key follow the same region strategy as aws_secretsmanager_secret? New resource: aws_kms_multi_region_key to define both primary and replica keys Dec 15, 2021
@lnattrass
Copy link
Author

I could swear I searched - yes that would definitely do what I think we need

@bacoboy-doordash
Copy link

bacoboy-doordash commented Dec 20, 2021

It would help with creation of the replica keys, but you'd still have to have region specific providers to set the regional aws_kms_alias is one thought I had.

This might also help with my particular issue of creating the replicas using an already assumed role since aws_kms_replica_key seems to fail on the second role assumption -- so I'm kinda stuck w/o this as a workaround:

aws_kms_replica_key.data-key-use2: Creating...
╷
│ Error: error creating AWS session: SharedConfigErr: only one credential type may be specified per profile: source profile, credential source, credential process, web identity token, or sso
│
│   with aws_kms_replica_key.data-key-use2,
│   on kms.tf line 17, in resource "aws_kms_replica_key" "data-key-use2":
│   17: resource "aws_kms_replica_key" "data-key-use2" {

I can import this key once created and apparently modify it too, but not create outright. Should probably file a bug - but I suppose there isn't a direct fix. The aws_kms_replica_key resource doesn't seem to work if your provider has a profile entry ¯\_(ツ)_/¯

Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Dec 13, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 12, 2024
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 Feb 12, 2024
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/kms Issues and PRs that pertain to the kms service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Projects
None yet
Development

No branches or pull requests

3 participants