-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Unable to remove the filter_policy from aws_sns_topic_subscription #3328
Comments
@oanasabau sorry you're running into trouble with this. I'm able to reproduce by adding an additional step to the existing acceptance test that tries to remove the filter policy and receive the same error from the SNS API. What's even more curious is that I'm not sure how to coerce the SNS SDK to "unset" the filter policy easily. 😢
Does it happen to work from the AWS CLI without the |
I get same errors when running the command using aws cli.
An error occurred (InvalidParameter) when calling the SetSubscriptionAttributes operation: Invalid parameter: FilterPolicy: Filter is not an object
An error occurred (InvalidParameter) when calling the SetSubscriptionAttributes operation: Invalid parameter: FilterPolicy: Filter is not an object
An error occurred (InvalidParameter) when calling the SetSubscriptionAttributes operation: Invalid parameter: FilterPolicy: Empty objects are not allowed |
This is the info displayed when trying to edit subscription filter policy in the amazon console:
Maybe this can be solved by deleting and recreating the resource without the policy filter? |
That sounds like it might be our only option given the lack of backend API support. It certainly deserves a documentation note on our end and we can add a |
One thing to consider when doing this is what happens with the messages if the new resource cannot be created before the old one is destroyed (some messages might be lost). |
FYI, have you tried a workaround of removing the filter_policy from the config and then tainting the subscription resource so it is recreated? That would delete the whole subscription (and the filter_policy) and recreate it (without the filter_policy). |
Since we can update the value but can't remove it, we might solve this issue by implementing the CustomizeDiff and marking the resource as ForceNew (example). Thoughts? :) |
You can unset a subscription filter policy by providing an empty JSON object. Have a look at the CLI example below.
|
More info about removing filter policies can be found here: |
Pull request submitted: #6023 |
The fix for this issue has been merged and will release with version 1.39.0 of the AWS provider, likely later today. |
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! |
Hi there,
After updating to new version of the aws terraform provider we are unable to remove the filter_policy from a sns subscription when running terraform apply.
The terraform configuration for the sns subscription was created without the filter policy and the policy was added using aws cli. Since the filter policy is not in the configuration file terraform will try to remove it and fail.
The same issue can be reproduced if you remove the filter_policy argument from aws_sns_topic_subscription resource after applying the configuration.
Terraform Version
Affected Resource(s)
Terraform Configuration Files
Terraform plan
Terraform will perform the following actions:
~ module.test.aws_sns_topic_subscription.test-subscription
filter_policy: "{"TYPE":["TEST"]}" => ""
Expected Behavior
The filter policy should have been removed.
Actual Behavior
Error: Error applying plan:
1 error(s) occurred:
module.test.aws_sns_topic_subscription.test-subscription: 1 error(s) occurred:
aws_sns_topic_subscription.test-subscription: Unable to set filter policy attribute on subscription: InvalidParameter: Invalid parameter: FilterPolicy: Filter is not an object
at [Source: ; line: 1, column: 1]
The text was updated successfully, but these errors were encountered: