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

Enabled updates to existing IAM Access Keys #7961

Merged
merged 3 commits into from
Mar 17, 2019
Merged

Conversation

owenfarrell
Copy link
Contributor

@owenfarrell owenfarrell commented Mar 15, 2019

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

Changes proposed in this pull request:

  • Flag the IAM Access Key status field as optional to support disabling keys via Terraform (e.g. automate key rotation)

Output from acceptance testing:

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSAccessKey_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -parallel 20 -run=TestAccAWSAccessKey_ -timeout 120m
=== RUN   TestAccAWSAccessKey_basic
=== PAUSE TestAccAWSAccessKey_basic
=== RUN   TestAccAWSAccessKey_encrypted
=== PAUSE TestAccAWSAccessKey_encrypted
=== RUN   TestAccAWSAccessKey_inactive
=== PAUSE TestAccAWSAccessKey_inactive
=== CONT  TestAccAWSAccessKey_basic
=== CONT  TestAccAWSAccessKey_encrypted
=== CONT  TestAccAWSAccessKey_inactive
--- PASS: TestAccAWSAccessKey_encrypted (9.02s)
--- PASS: TestAccAWSAccessKey_basic (9.06s)
--- PASS: TestAccAWSAccessKey_inactive (12.34s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       12.396s

@ghost ghost added size/S Managed by automation to categorize the size of a PR. service/iam Issues and PRs that pertain to the iam service. documentation Introduces or discusses updates to documentation. labels Mar 15, 2019
@ghost ghost added size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. and removed size/S Managed by automation to categorize the size of a PR. labels Mar 16, 2019
@owenfarrell owenfarrell force-pushed the master branch 2 times, most recently from fdd780a to 48ca2ea Compare March 16, 2019 01:44
@bflad bflad added the enhancement Requests to existing resources that expand the functionality or scope. label Mar 17, 2019
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.

Hi @owenfarrell 👋 Thanks for this contribution! Looking pretty good, two little items and this should be good to go.

@@ -28,6 +29,7 @@ func resourceAwsIamAccessKey() *schema.Resource {
},
"status": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please add a validation function to this attribute? 👍

"status": {
  Type:     schema.TypeString,
  Optional: true,
  Computed: true,
  ValidateFunc: validation.StringInSlice([]string{
    iam.StatusTypeActive,
    iam.StatusTypeInactive,
  }, false),
},

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done - thanks for the pointer!

@@ -55,6 +55,7 @@ The following arguments are supported:
* `user` - (Required) The IAM user to associate with this access key.
* `pgp_key` - (Optional) Either a base-64 encoded PGP public key, or a
keybase username in the form `keybase:some_person_that_exists`.
* `status` - (Optional) The access key status to apply. Defaults to "Active".
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please note here that the other valid value is Inactive. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a line with the set of valid values.

@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label Mar 17, 2019
@owenfarrell
Copy link
Contributor Author

@bflad - I reran the associated acceptance tests after the validation function change and everything still looks good.

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -parallel 20 -run=TestAccAWSAccessKey_ -timeout 120m
=== RUN   TestAccAWSAccessKey_basic
=== PAUSE TestAccAWSAccessKey_basic
=== RUN   TestAccAWSAccessKey_encrypted
=== PAUSE TestAccAWSAccessKey_encrypted
=== RUN   TestAccAWSAccessKey_inactive
=== PAUSE TestAccAWSAccessKey_inactive
=== CONT  TestAccAWSAccessKey_basic
=== CONT  TestAccAWSAccessKey_inactive
=== CONT  TestAccAWSAccessKey_encrypted
--- PASS: TestAccAWSAccessKey_encrypted (7.93s)
--- PASS: TestAccAWSAccessKey_basic (8.21s)
--- PASS: TestAccAWSAccessKey_inactive (11.31s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       11.354s

@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label Mar 17, 2019
@bflad bflad added this to the v2.3.0 milestone Mar 17, 2019
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.

LGTM, thanks @owenfarrell! 🚀

--- PASS: TestAccAWSAccessKey_basic (7.72s)
--- PASS: TestAccAWSAccessKey_encrypted (7.72s)
--- PASS: TestAccAWSAccessKey_inactive (11.21s)

@bflad bflad merged commit 904a776 into hashicorp:master Mar 17, 2019
bflad added a commit that referenced this pull request Mar 17, 2019
@bflad
Copy link
Contributor

bflad commented Mar 21, 2019

This has been released in version 2.3.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Mar 31, 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 31, 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/iam Issues and PRs that pertain to the iam 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.

2 participants