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

KMS asymmetric keys #11062

Merged
merged 1 commit into from
Jan 29, 2020
Merged

KMS asymmetric keys #11062

merged 1 commit into from
Jan 29, 2020

Conversation

ewbankkit
Copy link
Contributor

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" comments, they generate extra noise for pull request followers and do not help prioritize the request

Closes #11042.

Release note for CHANGELOG:

data-source/aws_kms_key: Add `customer_master_key_spec` attribute
resource/aws_kms_key: Add support for asymmetric keys with `customer_master_key_spec` attribute

Output from acceptance testing:

$ make testacc TEST=./aws TESTARGS='-run=TestAccDataSourceAwsKmsKey_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccDataSourceAwsKmsKey_ -timeout 120m
=== RUN   TestAccDataSourceAwsKmsKey_basic
=== PAUSE TestAccDataSourceAwsKmsKey_basic
=== CONT  TestAccDataSourceAwsKmsKey_basic
--- PASS: TestAccDataSourceAwsKmsKey_basic (51.46s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	51.485s
$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSKmsKey_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSKmsKey_ -timeout 120m
=== RUN   TestAccAWSKmsKey_basic
=== PAUSE TestAccAWSKmsKey_basic
=== RUN   TestAccAWSKmsKey_asymmetricKey
=== PAUSE TestAccAWSKmsKey_asymmetricKey
=== RUN   TestAccAWSKmsKey_disappears
=== PAUSE TestAccAWSKmsKey_disappears
=== RUN   TestAccAWSKmsKey_policy
=== PAUSE TestAccAWSKmsKey_policy
=== RUN   TestAccAWSKmsKey_isEnabled
=== PAUSE TestAccAWSKmsKey_isEnabled
=== RUN   TestAccAWSKmsKey_tags
=== PAUSE TestAccAWSKmsKey_tags
=== CONT  TestAccAWSKmsKey_basic
=== CONT  TestAccAWSKmsKey_isEnabled
=== CONT  TestAccAWSKmsKey_tags
=== CONT  TestAccAWSKmsKey_disappears
=== CONT  TestAccAWSKmsKey_policy
=== CONT  TestAccAWSKmsKey_asymmetricKey
--- PASS: TestAccAWSKmsKey_disappears (18.90s)
--- PASS: TestAccAWSKmsKey_asymmetricKey (46.80s)
--- PASS: TestAccAWSKmsKey_basic (51.43s)
--- PASS: TestAccAWSKmsKey_tags (70.11s)
--- PASS: TestAccAWSKmsKey_policy (70.43s)
--- PASS: TestAccAWSKmsKey_isEnabled (395.66s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	395.715s

@ewbankkit ewbankkit requested a review from a team November 29, 2019 00:16
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. documentation Introduces or discusses updates to documentation. service/kms Issues and PRs that pertain to the kms service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Nov 29, 2019
@@ -44,11 +44,27 @@ func resourceAwsKmsKey() *schema.Resource {
"key_usage": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Default: kms.KeyUsageTypeEncryptDecrypt,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Set Default rather than marking as Computed.

@@ -113,11 +131,8 @@ func TestAccAWSKmsKey_disappears(t *testing.T) {
Config: testAccAWSKmsKey(rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSKmsKeyExists(resourceName, &key),
testAccCheckAWSKmsKeyDisappears(&key),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually delete the KMS key 😄.

@@ -222,6 +243,13 @@ func TestAccAWSKmsKey_tags(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"deletion_window_in_days"},
},
{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ensure tags are removed.

deletion_window_in_days = 7

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No policy or tags for basic configuration.

@AlexanderIakovlev
Copy link

@bflad hello, could you help with review and approval?
looks like all activities done and this PR could be reviewed.
Or maybe if you are busy, could you suggest best person to merge this PR?

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Jan 29, 2020
@bflad bflad self-assigned this Jan 29, 2020
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Looks great, @ewbankkit, thanks so much 🚀

Output from acceptance testing:

--- PASS: TestAccDataSourceAwsKmsKey_basic (28.69s)

--- PASS: TestAccAWSKmsKey_disappears (7.85s)
--- PASS: TestAccAWSKmsKey_asymmetricKey (28.29s)
--- PASS: TestAccAWSKmsKey_basic (28.83s)
--- PASS: TestAccAWSKmsKey_tags (33.60s)
--- PASS: TestAccAWSKmsKey_policy (34.15s)
--- PASS: TestAccAWSKmsKey_isEnabled (311.63s)

@@ -35,41 +40,23 @@ func TestAccDataSourceAwsKmsKey_basic(t *testing.T) {

func testAccDataSourceAwsKmsKeyCheck(name string) resource.TestCheckFunc {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can get rid of this in the future. 👍

ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
"",
Copy link
Contributor

Choose a reason for hiding this comment

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

Phew, that validation has been present since the creation of the resource, but I believe this should be okay to remove as it likely generated a difference when applied.

@bflad bflad added this to the v2.47.0 milestone Jan 29, 2020
@bflad bflad merged commit a33d84c into hashicorp:master Jan 29, 2020
bflad added a commit that referenced this pull request Jan 29, 2020
@ewbankkit ewbankkit deleted the issue-11042 branch January 30, 2020 12:33
@ghost
Copy link

ghost commented Jan 30, 2020

This has been released in version 2.47.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 for triage. Thanks!

jaspervdj-luminal pushed a commit to LuminalHQ/terraform-provider-aws that referenced this pull request Feb 6, 2020
Output from acceptance testing:

```
--- PASS: TestAccDataSourceAwsKmsKey_basic (28.69s)

--- PASS: TestAccAWSKmsKey_disappears (7.85s)
--- PASS: TestAccAWSKmsKey_asymmetricKey (28.29s)
--- PASS: TestAccAWSKmsKey_basic (28.83s)
--- PASS: TestAccAWSKmsKey_tags (33.60s)
--- PASS: TestAccAWSKmsKey_policy (34.15s)
--- PASS: TestAccAWSKmsKey_isEnabled (311.63s)
```
@ghost
Copy link

ghost commented Mar 27, 2020

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!

@ghost ghost locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/kms Issues and PRs that pertain to the kms service. size/XL 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.

KMS asymmetric keys
3 participants