[Bug]: TopicSubscription.spec.forProvider.filterPolicyScope
cannot be removed once .filterPolicy
was set
#1566
Labels
Is there an existing issue for this?
Affected Resource(s)
sns.aws.upbound.io/v1beta1
Resource MRs required to reproduce the bug
Steps to Reproduce
If this MR is first deployed, the MR
.status.atProvider.filterPolicyScope
field will be set toMessageAttributes
value.Then if a new MR generation is without
.spec.forProvider.filterPolicy
, the MR.status.conditions[].message
will beand
.reason: ReconcileError
.What happened?
We're building the MR through a
mode: Pipeline
Composition with function-go-templating step, that allows the self-service platform consumer inject.spec.forProvider.filterPolicy
(and only that, the filterPolicyScope is added by the provider controller if filterPolicy is present, I think), but consumer may later decide to drop filterPolicy (updating some helm values, Composite Claim is deployed with Helm) and then the MR would not have.spec.forProvider.filterPolicy
, but it would still have.spec.forProvider.filterPolicyScope
, resulting in the mentioned error.Crossplane provider controller adds
TopicSubscription.spec.forProvider.filterPolicyScope
as we can see in its.metadata.managedFields
By the look of it, this is caused by Terraform provider underlying the Crossplane provider: https://github.com/hashicorp/terraform-provider-aws/blob/v5.58.0/internal/service/sns/topic_subscription.go#L571-L573.
And trying to template the Composition to "nullify" this with sending an empty string
""
for either.spec.forProvider.filterPolicy
,.spec.forProvider.filterPolicyScope
, or even both at the same time, did not help, even though this code should have removed filterPolicyScope.Relevant Error Output Snippet
Crossplane Version
1.18.0
Provider Version
1.14.0
Kubernetes Version
v1.28.13
Kubernetes Distribution
EKS v1.28.13-eks-a737599
Additional Info
The provider:
$ kubectl get pod -n crossplane-system provider-aws-upbound-sns-5836380c004f-6cd585b7c8-cq2sk -o yaml | yq .spec.containers[].image xpkg.upbound.io/upbound/provider-aws-sns:v1.14.0
MR error when trying to reset filterPolicyScope from Composition:
we still get the error
PRs https://github.com/hashicorp/terraform-provider-aws/pull/28004/files & https://github.com/hashicorp/terraform-provider-aws/pull/28253/files cover
filter_policy_scope
feature in Terraform provider and I think the issue may be with https://github.com/hashicorp/terraform-provider-aws/blob/v5.58.0/internal/service/sns/topic_subscription.go#L546C1-L549C59I see this
diff
type is from Go package https://github.com/hashicorp/terraform-plugin-sdk/blob/v2.34.0/helper/schema/resource_diff.go#L104-L146 but I don't get why thehasPolicy
andhasScope
are determined with different methods. Somehow the conditional branch fordiff.Clear("filter_policy_scope")
is skipped.Would this be a bug in the Terraform provider and should I report it there?
Thanks a lot!
The text was updated successfully, but these errors were encountered: