-
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
datasource/aws_kms_alias: Add target_key_arn attribute #2551
Conversation
@bflad Thank you so so much for this! I was meaning to add it myself after the second time I had to hand-assemble the target key ARN in my configs. :-D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks overall good - just one nitpick about readability/cleanliness of the check.
Also do you mind resolving conflicts in the docs?
Thanks.
attr["target_key_arn"], | ||
targetKeyArn, | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you feel about regexp
matching with $
here? It seems that would be a little bit cleaner approach compared to modification of the original attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be awesome to have right now. I racked by brain all day wondering why my aws_efs_file_system instances were being recreated and discovered that it was due to a recent update to our stack that includes looking up a kms key:
resource "aws_efs_file_system" "efs" {
creation_token = "${local.dbcluster}-efs-${var.env}"
encrypted = true
kms_key_id = "${data.aws_kms_alias.efs.arn}"
tags {
Name = "${local.dbcluster}-efs-${var.env}"
Environment = "${var.env}"
Terraform = "true"
}
}
Learning more about this, what we really need is the target key's arn and not the alias
I'll update and merge this PR after we release v1.7.1 (hopefully tomorrow). 🚀 |
d6567a9
to
0008ef1
Compare
Rebased and updated if you'd like to give another look
|
Helps/fixes #3019 |
This has been released in terraform-provider-aws version 1.8.0. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
This is an alternate implementation to #2224. Closes #2009.
KMS keys and aliases are bound to the same AWS partition, account, and region so it is safe to assemble the target key ARN from the alias ARN and target key ID. Reference: http://docs.aws.amazon.com/sdk-for-go/api/service/kms/#KMS.CreateAlias