crossplane-contrib / provider-aws

Crossplane AWS Provider
Apache License 2.0
418 stars 363 forks source link

Subscriptions with filterPolicy set are in a SetSubscriptionAttributes loop #2071

Open offzale opened 2 weeks ago

offzale commented 2 weeks ago

What happened?

When creating a Subscription with the field spec.forProvider.filterPolicy set, the provider gets in a loop of SetSubscriptionAttributes AWS API calls trying to update that attribute. The resources are ready and synced.

All the API calls have the following requestParameters:

"requestParameters": {
        "subscriptionArn": "arn:aws:sns:eu-west-1:000123456789:example-subscription:<aws-resource-id>",
        "attributeName": "FilterPolicy",
        "attributeValue": "{ \"status\": [\"EXAMPLE\"] }\n"
    },

How can we reproduce it?

Create a topic and a queue, then subscribe the queue to the topic setting the filterPolicy below.

apiVersion: sns.aws.crossplane.io/v1beta1
kind: Subscription
metadata:
  name: example
spec:
  deletionPolicy: Delete
  forProvider:
    endpoint: arn:aws:sqs:eu-west-1:000123456789:example-queue
    filterPolicy: |
      { "status": ["EXAMPLE"] }
    filterPolicyScope: MessageAttributes
    protocol: sqs
    rawMessageDelivery: "false"
    region: eu-west-1
    topicArn: arn:aws:sns:eu-west-1:000123456789:example-topic
  managementPolicies:
  - '*'
  providerConfigRef:
    name: aws

What environment did it happen in?

Crossplane version: 1.16.0 Provider version: 0.9.0

offzale commented 2 weeks ago

@MisterMX could this issue be related to the one that we had with the diff on the topics policy? https://github.com/crossplane-contrib/provider-aws/commit/78bac9cec2bed776915c9d9fa063c40b37e8a3c7