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

fix KMS name validation check #13000

Merged
merged 3 commits into from Apr 28, 2022
Merged

fix KMS name validation check #13000

merged 3 commits into from Apr 28, 2022

Conversation

drexler
Copy link
Contributor

@drexler drexler commented Apr 24, 2020

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment 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 pull request followers and do not help prioritize the request

Closes #12891

Release note for CHANGELOG:

fix KMS name validation check

Output from acceptance testing:

$  make testacc TEST=./aws TESTARGS='-run=TestValidateAwsKmsName'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestValidateAwsKmsName -timeout 120m
=== RUN   TestValidateAwsKmsName
--- PASS: TestValidateAwsKmsName (0.00s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	0.069s

...

@drexler drexler requested a review from a team April 24, 2020 02:31
@ghost ghost added needs-triage Waiting for first response or review from a maintainer. size/XS Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Apr 24, 2020
Base automatically changed from master to main January 23, 2021 00:57
@breathingdust breathingdust requested a review from a team as a code owner January 23, 2021 00:57
@breathingdust breathingdust added bug Addresses a defect in current functionality. service/kms Issues and PRs that pertain to the kms service. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 21, 2021
@zhelding
Copy link
Contributor

Pull request #21306 has significantly refactored the AWS Provider codebase. As a result, most PRs opened prior to the refactor now have merge conflicts that must be resolved before proceeding.

Specifically, PR #21306 relocated the code for all AWS resources and data sources from a single aws directory to a large number of separate directories in internal/service, each corresponding to a particular AWS service. This separation of code has also allowed for us to simplify the names of underlying functions -- while still avoiding namespace collisions.

We recognize that many pull requests have been open for some time without yet being addressed by our maintainers. Therefore, we want to make it clear that resolving these conflicts in no way affects the prioritization of a particular pull request. Once a pull request has been prioritized for review, the necessary changes will be made by a maintainer -- either directly or in collaboration with the pull request author.

For a more complete description of this refactor, including examples of how old filepaths and function names correspond to their new counterparts: please refer to issue #20000.

For a quick guide on how to amend your pull request to resolve the merge conflicts resulting from this refactor and bring it in line with our new code patterns: please refer to our Service Package Refactor Pull Request Guide.

@anGie44 anGie44 self-assigned this Mar 25, 2022
@anGie44 anGie44 force-pushed the kms-regex-fix branch 2 times, most recently from 25ba40d to 66fc167 Compare April 28, 2022 17:17
@github-actions github-actions bot added size/M Managed by automation to categorize the size of a PR. and removed size/XS Managed by automation to categorize the size of a PR. labels Apr 28, 2022
@github-actions github-actions bot added size/XS Managed by automation to categorize the size of a PR. size/M Managed by automation to categorize the size of a PR. and removed size/M Managed by automation to categorize the size of a PR. size/XS Managed by automation to categorize the size of a PR. labels Apr 28, 2022
@anGie44
Copy link
Contributor

anGie44 commented Apr 28, 2022

Output of acceptance tests:

--- PASS: TestAccKMSAliasDataSource_awsService (15.30s)
--- PASS: TestAccKMSAlias_disappears (20.19s)
--- PASS: TestAccKMSAliasDataSource_cmk (20.68s)
--- PASS: TestAccKMSAlias_basic (22.71s)
--- PASS: TestAccKMSAlias_namePrefix (22.99s)
--- PASS: TestAccKMSAlias_Name_generated (23.00s)
--- PASS: TestAccKMSAlias_multipleAliasesForSameKey (23.09s)
--- PASS: TestAccKMSAlias_arnDiffSuppress (30.79s)
--- PASS: TestAccKMSAlias_updateKeyID (35.19s)

--- PASS: TestValidNameForDataSource (0.00s)
--- PASS: TestValidNameForResource (0.00s)

@anGie44 anGie44 added this to the v4.12.0 milestone Apr 28, 2022
Copy link
Contributor

@anGie44 anGie44 left a comment

Choose a reason for hiding this comment

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

Thanks for this contribution @drexler , LGTM 🚀

@anGie44 anGie44 merged commit b36140d into hashicorp:main Apr 28, 2022
@github-actions
Copy link

This functionality has been released in v4.12.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!

@ArchiFleKs
Copy link

I think the PR checks against alias/aws and not alias/aws/ I have a KMS key :

│ Error: "name" cannot begin with reserved AWS CMK prefix 'alias/aws'
│ 
│   with aws_kms_alias.aws-ebs-csi-driver[0],
│   on aws-ebs-csi-driver.tf line 212, in resource "aws_kms_alias" "aws-ebs-csi-driver":
│  212:   name          = "alias/aws-ebs-csi-driver-${local.aws-ebs-csi-driver.override_kms_alias != null ? local.aws-ebs-csi-driver.override_kms_alias : var.cluster-name}"

Which failed. Is the AWS API enforce alias/aws/* or alias/aws*

ArchiFleKs added a commit to particuleio/terraform-kubernetes-addons that referenced this pull request Apr 29, 2022
Related to hashicorp/terraform-provider-aws#13000

Signed-off-by: Kevin Lefevre <kevin@particule.io>
mergify bot pushed a commit to particuleio/terraform-kubernetes-addons that referenced this pull request Apr 29, 2022
Related to hashicorp/terraform-provider-aws#13000

Signed-off-by: Kevin Lefevre <kevin@particule.io>
@anGie44
Copy link
Contributor

anGie44 commented Apr 29, 2022

Hi @ArchiFleKs , thanks for commenting here! The API enforces alias/aws/* , though I could of sworn i read in the docs yesterday it was alias/aws*. Apologies for the regression. Will add a PR shortly to address this.

@anGie44
Copy link
Contributor

anGie44 commented Apr 29, 2022

@ArchiFleKs , just wanted to let you know the fix was released recently in v4.12.1

@github-actions
Copy link

I'm going to lock this pull request 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 related to this change, 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 May 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/kms Issues and PRs that pertain to the kms service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws_kms_alias API ValidationException
5 participants