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

provider/aws: SNS Topic State Refreshing correctly #4891

Merged
merged 1 commit into from
Jan 29, 2016

Conversation

stack72
Copy link
Contributor

@stack72 stack72 commented Jan 28, 2016

Fixes #4888

Provider/aws - SNS Topics deleted from the UI were causing Terraform to throw an error:

  • aws_sns_topic_subscription.checker: NotFound: Subscription does not
  • exist
    status code: 404, request id: b8ca0c27-1a62-57b3-8b96-43038a0ead86

Terraform wasn't refreshing the state when the topic gave a 404

@@ -163,6 +165,12 @@ func resourceAwsSnsTopicRead(d *schema.ResourceData, meta interface{}) error {
})

if err != nil {
if ec2err, ok := err.(awserr.RequestFailure); ok && ec2err.StatusCode() == http.StatusNotFound {
Copy link
Member

Choose a reason for hiding this comment

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

Usually (at least from what I've seen elsewhere in the codebase) we check ec2err.Code() (which in this case would be NotFound) which would help you avoiding that extra import of net/http.

Also (but that's really a nitpick), this is a generic AWS error, has nothing to do with EC2. I know this pattern is sprinkled throughout the codebase with EC2 in the name which makes me think we should probably rename all of those variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense @radeksimko - will fix and re-push first thing

throw an error:

* aws_sns_topic_subscription.checker: NotFound: Subscription does not
* exist
    status code: 404, request id: b8ca0c27-1a62-57b3-8b96-43038a0ead86

Terraform wasn't refreshing the state when the topic gave a 404
@stack72 stack72 force-pushed the f-aws-sns-ui-deleted branch from 9210201 to 91cb65d Compare January 28, 2016 23:26
@stack72
Copy link
Contributor Author

stack72 commented Jan 28, 2016

@radeksimko ok, this was a pretty simple change to make - just repushed it

@radeksimko
Copy link
Member

LGTM, feel free to merge once Travis turns to green.

@radeksimko
Copy link
Member

Also after merging don't forget to update the Changelog.md, we typically do this manually via github web interface (to avoid conflicts). 😉

stack72 added a commit that referenced this pull request Jan 29, 2016
provider/aws: SNS Topic State Refreshing correctly
@stack72 stack72 merged commit 2bc5d25 into hashicorp:master Jan 29, 2016
@stack72 stack72 deleted the f-aws-sns-ui-deleted branch January 29, 2016 11:03
@ghost
Copy link

ghost commented Apr 28, 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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fails to refresh state SNS subscription deletions
2 participants