-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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_sqs_queue_policy: Prevent missing policy error on read #2739
resource/aws_sqs_queue_policy: Prevent missing policy error on read #2739
Conversation
… missing policy error on read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one question to consider - otherwise the PR looks reasonable.
Arguably this could be removed or moved into the read as well.
I would not put it there. We have very little control over where is method going to be called from - e.g. on refresh - in such case it's desirable to show difference when the resource was modified outside of Terraform.
aws/resource_aws_sqs_queue_policy.go
Outdated
return out, "", nil | ||
}, | ||
} | ||
_, err = wait.WaitForState() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered using the resource.Retry
helper instead of this wrapper? We'd still need to make up the error message when policies aren't equivalent, but I feel that it'd be a little bit cleaner as the whole thing isn't really "stateful". 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also we're catching all errors here and treating them as "retryable" which (IMO) isn't ideal. I assume the goal is to only catch AWS.SimpleQueueService.NonExistentQueue
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call on both of these -- I'll get this PR updated shortly.
….StateChangeConf Additionally: * Supplement debug logging * Use sqs.QueueAttributeNamePolicy constant
Updated 😄
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks 👍
This has been released in terraform-provider-aws version 1.8.0. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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! |
SQS attribute creation/updates can take up to 60 seconds for propagation. This PR addresses two facets:
resource.StateChangeConf
on upsert to try to wait for the new/updated policy. Arguably this could be removed or moved into the read as well.Closes #2669