-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
provider/aws: Enforced kms_key_* attributes to be ARNs #10356
Conversation
79f5321
to
5b3da09
Compare
5b3da09
to
71a447d
Compare
9d1fc30
to
a0f429d
Compare
Hi @Ninir Thanks for the work here - this seems sane to me! I have 1 request though, I think we should add some tests around the validateArn function - this will allow us to be able to test that the validations work without the need to run all of the acceptance tests We do a similar thing for most of the validateFuncs Hope this is ok? Paul |
Hey @stack72 The validateArn function is already testing on its own as far as I saw. Do you mean having tests, thus having a config, that will expect errors such as Thanks! |
@Ninir we have the acceptance tests and these are great - we usually try and add unit tests to the validate func as well See https://github.com/hashicorp/terraform/blob/master/builtin/providers/aws/resource_aws_db_option_group.go#L347 As you can see, this tests that the values are as expected :) These tests get run at build time Paul |
@stack72 Agreed on all of this :) As far as I understand (hope I did well 😅 ), these unit tests are already implemented (thus why I didn't create them) here: https://github.com/hashicorp/terraform/blob/master/builtin/providers/aws/validators_test.go#L188 Sorry If I didn't get the point :) |
AAAHHHH!!! You just reimplemented a function that was already there - well in that case, LGTM! Thanks for all of the work here P. |
Yeah indeed! will make the PR description more helpful on that next time. Thanks for the quick answers @stack72 (as always :) ) |
* Added kms_key_* validation to force ARNs * Added Redshift Cluster KMS key test * Added cloudtrail kms key test * Added EBS volume kms key * Added Elastic Transcoder Pipeline kms key arn test
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. |
Reasonning
At the moment, it is possible to use the KMS Key ID, the KMS Key Alias or the KMS Key ARN.
Since AWS is sending back ARNs only, using something else than Kms Key ARNs means that resources are always flapping, thus triggering and update on each change.
Thus, this enforces kms_key_* attributes to be ARNs.
Related issues
Closes #10070
Fixes #9626
TODOs