Open emansawalhaa opened 3 months ago
Voting for Prioritization
Volunteering to Work on This Issue
@emansawalhaa For clarification, is it the correct interpretation that applying the Terraform configuration after removing the aws_sns_topic_subscription
resource is successful (i.e. the subscription is deleted successfully), but you see an error in the log and CloudTrail for a failed call to the FindSubscriptionAttributesByARN
API with a 404 response?
If so, this behavior is expected. During deletion, the Terraform resource code calls the Unsubscribe
API which is asynchronous. It then needs to check for completion by polling for a a subscription attribute until the API returns a 404 indicating that the subscription is deleted. You can safely ignore the "error".
You may see similar pattern with other Terraform resources.
Terraform Core Version
1.5.7
AWS Provider Version
5.57.0
Affected Resource(s)
Hi All,
We're encountering a strange issue with Terraform (TF). After deleting any aws_sns_topic_subscription, TF generates an error related to the subscription's deletion (
Subscription does not exist
). Specifically, we've observed that the GetSubscriptionAttributes operation is triggered on the deleted subscriptions after they are unsubscribed.This behavior is quite annoying, as it appears in CloudTrail logs. While it doesn't significantly affect the deletion process (TF successfully executes the deletion), errors about non-existent subscriptions are generated.
Could someone clarify if this behavior is expected? Why is TF checking the attributes of a deleted subscription's ARN after it has been unsubscribed/deleted?
thanks,
Expected Behavior
GetSubscriptionAttributes should not be triggered after an aws_sns_topic_subscription is deleted.
Actual Behavior
After deleting an aws_sns_topic_subscription, we consistently observe a Subscription does not exist error in the Terraform (TF) logs.
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Steps to Reproduce
Debug Output
After enabling debug mode (TF_LOG_PROVIDER), you can observe the error in the Terraform logs:
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None