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

Add support for advanced SSM parameters #8525

Merged
merged 3 commits into from
May 9, 2019
Merged

Add support for advanced SSM parameters #8525

merged 3 commits into from
May 9, 2019

Conversation

davidcelis
Copy link
Contributor

@davidcelis davidcelis commented May 3, 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

Release note for CHANGELOG:

resource/aws_ssm_parameter: Add `tier` argument [GH-8525]

@ghost ghost added size/S Managed by automation to categorize the size of a PR. service/ssm Issues and PRs that pertain to the ssm service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels May 3, 2019
@ghost ghost added the documentation Introduces or discusses updates to documentation. label May 3, 2019
@bflad bflad added the enhancement Requests to existing resources that expand the functionality or scope. label May 6, 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 @davidcelis 👋 Thanks for contributing this! Its off to a good start -- a few testing things and it should be good to go. Please reach out with any questions or if you do not have time to implement the feedback.

aws/resource_aws_ssm_parameter_test.go Outdated Show resolved Hide resolved
aws/resource_aws_ssm_parameter_test.go Outdated Show resolved Hide resolved
@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label May 6, 2019
@bflad bflad self-requested a review May 9, 2019 19:47
@bflad bflad removed the waiting-response Maintainers are waiting on response from community or contributor. label May 9, 2019
@bflad
Copy link
Contributor

bflad commented May 9, 2019

Hey @davidcelis, thanks for the updates here! When testing this for merging I swapped out the testing to also perform updates for the tier argument similar to #8525 (comment) and discovered that updating from Advanced to Standard returned the following API error:

--- FAIL: TestAccAWSSSMParameter_Tier (25.65s)
    testing.go:568: Step 1 error: errors during apply:

        Error: error creating SSM parameter: ValidationException: This parameter uses the advanced-parameter tier. You can't downgrade a parameter from the advanced-parameter tier to the standard-parameter tier. If necessary, you can delete the advanced parameter and recreate it as a standard parameter. Be aware that standard parameters have a value limit of 4096 characters.
        	status code: 400, request id: 8ffb05d8-5977-4226-8ef5-276b5be1fece

So! Turns out this needed some extra love for that specific scenario and in this case a relatively safe and simple CustomizeDiff only trigger resource recreation for this particular issue:

		CustomizeDiff: customdiff.All(
			// Prevent the following error during tier update from Advanced to Standard:
			// ValidationException: This parameter uses the advanced-parameter tier. You can't downgrade a parameter from the advanced-parameter tier to the standard-parameter tier. If necessary, you can delete the advanced parameter and recreate it as a standard parameter.
			customdiff.ForceNewIfChange("tier", func(old, new, meta interface{}) bool {
				return old.(string) == ssm.ParameterTierAdvanced && new.(string) == ssm.ParameterTierStandard
			}),
		),

With this in place, everything looks good. 🚀 Thanks so much for your contribution here! Should be able to get this released today. 👍

Output from acceptance testing after above changes:

--- PASS: TestAccAWSSSMParameter_disappears (9.99s)
--- PASS: TestAccAWSSSMParameter_basic (13.47s)
--- PASS: TestAccAWSSSMParameter_secure (13.74s)
--- PASS: TestAccAWSSSMParameter_fullPath (19.63s)
--- PASS: TestAccAWSSSMParameter_importBasic (21.78s)
--- PASS: TestAccAWSSSMParameter_updateTags (26.12s)
--- PASS: TestAccAWSSSMParameter_changeNameForcesNew (30.26s)
--- PASS: TestAccAWSSSMParameter_overwrite (32.02s)
--- PASS: TestAccAWSSSMParameter_updateDescription (35.51s)
--- PASS: TestAccAWSSSMParameter_Tier (37.83s)
--- PASS: TestAccAWSSSMParameter_secure_with_key (46.98s)
--- PASS: TestAccAWSSSMParameter_secure_keyUpdate (61.83s)

@bflad bflad added this to the v2.10.0 milestone May 9, 2019
@bflad bflad merged commit a51c66b into hashicorp:master May 9, 2019
bflad added a commit that referenced this pull request May 9, 2019
… trigger recreation for Advanced to Standard

Reference: #8525 (comment)

Output from acceptance testing:

```
--- PASS: TestAccAWSSSMParameter_disappears (9.99s)
--- PASS: TestAccAWSSSMParameter_basic (13.47s)
--- PASS: TestAccAWSSSMParameter_secure (13.74s)
--- PASS: TestAccAWSSSMParameter_fullPath (19.63s)
--- PASS: TestAccAWSSSMParameter_importBasic (21.78s)
--- PASS: TestAccAWSSSMParameter_updateTags (26.12s)
--- PASS: TestAccAWSSSMParameter_changeNameForcesNew (30.26s)
--- PASS: TestAccAWSSSMParameter_overwrite (32.02s)
--- PASS: TestAccAWSSSMParameter_updateDescription (35.51s)
--- PASS: TestAccAWSSSMParameter_Tier (37.83s)
--- PASS: TestAccAWSSSMParameter_secure_with_key (46.98s)
--- PASS: TestAccAWSSSMParameter_secure_keyUpdate (61.83s)
```
bflad added a commit that referenced this pull request May 9, 2019
@davidcelis davidcelis deleted the ssm-advanced-parameters branch May 10, 2019 00:24
@davidcelis
Copy link
Contributor Author

oh wow, thank you for helping me bring this across the finish line, @bflad!!

@bflad
Copy link
Contributor

bflad commented May 10, 2019

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

@marpada
Copy link

marpada commented May 10, 2019

@davidcelis thank you for being awesome!

@smolse
Copy link

smolse commented May 16, 2019

Hi guys. I'm afraid this pull request breaks SSM parameters management in AWS China. Please check #8662.

@ghost
Copy link

ghost commented Mar 30, 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 30, 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/ssm Issues and PRs that pertain to the ssm service. size/S 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.

4 participants