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

resource/aws_ssm_parameter: Refresh from state on 404 #1436

Merged

Conversation

stack72
Copy link
Contributor

@stack72 stack72 commented Aug 16, 2017

fixes: #1007

when an SSM Parameter is manually deleted, Terraform should recreate it.
For some reason, Terraform was inspecting the InvalidParameters part
of the response rather than actually checking that the Parameter was
returned. By removing this and then refreshing from state on no
parameters found, a manually deleted parameter can then be recreated

As part of this PR, a lot of the acceptance tests were restructured.
Previously, each acceptance tests was making multiple API requests to
check type and value of the param. This is replaced by 1 API request now
to check the Parameter now exists. We can then check the type and value
from our statefile

% make testacc TEST=./aws TESTARGS='-run=TestAccAWSSSMParameter_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSSSMParameter_ -timeout 120m
=== RUN   TestAccAWSSSMParameter_basic
--- PASS: TestAccAWSSSMParameter_basic (23.73s)
=== RUN   TestAccAWSSSMParameter_disappears
--- PASS: TestAccAWSSSMParameter_disappears (17.86s)
=== RUN   TestAccAWSSSMParameter_update
--- PASS: TestAccAWSSSMParameter_update (46.65s)
=== RUN   TestAccAWSSSMParameter_changeNameForcesNew
--- PASS: TestAccAWSSSMParameter_changeNameForcesNew (42.80s)
=== RUN   TestAccAWSSSMParameter_secure
--- PASS: TestAccAWSSSMParameter_secure (24.52s)
=== RUN   TestAccAWSSSMParameter_secure_with_key
--- PASS: TestAccAWSSSMParameter_secure_with_key (65.95s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	221.529s

fixes: hashicorp#1007

when an SSM Parameter is manually deleted, Terraform should recreate it.
For some reason, Terraform was inspecting the `InvalidParameters` part
of the response rather than actually checking that the Parameter was
returned. By removing this and then refreshing from state on no
parameters found, a manually deleted parameter can then be recreated

As part of this PR, a lot of the acceptance tests were restructured.
Previously, each acceptance tests was making multiple API requests to
check type and value of the param. This is replaced by 1 API request now
to check the Parameter now exists. We can then check the type and value
from our statefile

```
% make testacc TEST=./aws TESTARGS='-run=TestAccAWSSSMParameter_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSSSMParameter_ -timeout 120m
=== RUN   TestAccAWSSSMParameter_basic
--- PASS: TestAccAWSSSMParameter_basic (23.73s)
=== RUN   TestAccAWSSSMParameter_disappears
--- PASS: TestAccAWSSSMParameter_disappears (17.86s)
=== RUN   TestAccAWSSSMParameter_update
--- PASS: TestAccAWSSSMParameter_update (46.65s)
=== RUN   TestAccAWSSSMParameter_changeNameForcesNew
--- PASS: TestAccAWSSSMParameter_changeNameForcesNew (42.80s)
=== RUN   TestAccAWSSSMParameter_secure
--- PASS: TestAccAWSSSMParameter_secure (24.52s)
=== RUN   TestAccAWSSSMParameter_secure_with_key
--- PASS: TestAccAWSSSMParameter_secure_with_key (65.95s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	221.529s
```
@Ninir Ninir added the enhancement Requests to existing resources that expand the functionality or scope. label Aug 17, 2017
@Ninir Ninir merged commit 01476db into hashicorp:master Sep 7, 2017
nbaztec pushed a commit to nbaztec/terraform-provider-aws that referenced this pull request Sep 26, 2017
…hstate-on-404-1007

resource/aws_ssm_parameter: Refresh from state on 404
@ghost
Copy link

ghost commented Apr 11, 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 Apr 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Removing a parameter from the parameter store outside TF creates an error
2 participants