Hello everyone. Something I haven't been able to figure out is when Pulumi creates an SNS Topic Subscription, the value 'MessageBody' of the filterPolicyScope attribute is ignored and the default value of 'MessageAttributes' is used instead. If Pulumi is run a 2nd time without any code changes, Pulumi will detect a difference between the desired state ('MessageBody') and the current state ('MessageAttributes') and update the value to 'MessageBody'.
Any ideas why it would do that? Because of this, we have to remember to run Pulumi twice any time we want to create a new SNS Topic Subscription.
const createTopicSubscription = (
name: string,
endpoint: pulumi.Input<string>,
protocol: pulumi.Input<string>,
topic: aws.sns.Topic,
filterPolicy: pulumi.Input<string>,
) => {
const topicSubscription = new aws.sns.TopicSubscription(name, {
endpoint: endpoint,
protocol: protocol,
topic: topic,
filterPolicy: filterPolicy,
filterPolicyScope: 'MessageBody',
});
};