-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
SNS topic subscription is not recreated after SNS topic delete/recreate #9645
Comments
Hit this bug today. A little unnerving as now we can't be sure of the state of subscriptions. |
Any updates on that? Seems that one of the crucial TF feature is not working. We're also experiencing this issue. |
easier way to reproduce: apply the example completely. remove the subscription manually. The subscription will be in the state but it wont be recreated on the next run. Partial workaround: you need to remove the subscription from the state and rerun to recreate the subscription. (this doesnt help the fact that we never know if subscriptions are in place) |
It looks like there is an eventual consistency issue here, if you manually delete the subscription (unsubscribe) then for a short period $ aws --region eu-west-1 sns list-subscriptions
{
"Subscriptions": [
{
"SubscriptionArn": "arn:aws:sns:eu-west-1:123456789012:sns-topic:06f49a2d-b5c9-4565-a870-e3e9d68396d7",
"Owner": "123456789012",
"Protocol": "sqs",
"Endpoint": "arn:aws:sqs:eu-west-1:123456789012:sqs-queue",
"TopicArn": "arn:aws:sns:eu-west-1:123456789012:sns-topic"
}
]
}
$ aws --region eu-west-1 sns unsubscribe --subscription-arn arn:aws:sns:eu-west-1:123456789012:sns-topic:06f49a2d-b5c9-4565-a870-e3e9d68396d7
$ aws --region eu-west-1 sns list-subscriptions-by-topic --topic-arn arn:aws:sns:eu-west-1:123456789012:sns-topic
{
"Subscriptions": []
}
$ aws --region eu-west-1 sns get-subscription-attributes --subscription-arn arn:aws:sns:eu-west-1:123456789012:sns-topic:06f49a2d-b5c9-4565-a870-e3e9d68396d7
{
"Attributes": {
"Owner": "123456789012",
"RawMessageDelivery": "false",
"TopicArn": "arn:aws:sns:eu-west-1:123456789012:sns-topic",
"Endpoint": "arn:aws:sqs:eu-west-1:123456789012:sqs-queue",
"Protocol": "sqs",
"PendingConfirmation": "false",
"ConfirmationWasAuthenticated": "true",
"SubscriptionArn": "arn:aws:sns:eu-west-1:123456789012:sns-topic:06f49a2d-b5c9-4565-a870-e3e9d68396d7"
}
} The We should first use the |
Just been hit by this issue and I see Pr 14101 has been open a while as a fix for this. Is there anything I can do to progress the PR as this is quite an impactful bug |
This has been released in version 3.34.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
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! |
Community Note
Terraform Version
Terraform v0.11.14
provider.aws v2.22.0
Affected Resource(s)
Terraform Configuration Files
One directory with an SNS declaration :
Another directory with the SQS declaration
Debug Output
Debug Output
Expected Behavior
When applying the code containing the
aws_sns_topic_subscription
declaration it should always recreate it if it is NOT present.Actual Behavior
aws_sns_topic_subscription
is NOT recreated and attached when it isn't present in the topic subscription BUT present in the overall list of existing subscriptions.Steps to Reproduce
terraform init
andterraform apply
the SNS topic codeterraform init
andterraform apply
the SQS codeterraform destroy
the SNS topic codeterraform apply
the SNS topic codeterraform apply
the SQS codeResult after step 5:
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
But there is no subscription under the SNS topic, the
terraform apply
of the SQS code is not recreating the correct subscription.The text was updated successfully, but these errors were encountered: