diff --git a/patches/0077-Fix-spurious-JSON-diff-for-redrive_allow_policy.patch b/patches/0077-Fix-spurious-JSON-diff-for-redrive_allow_policy.patch new file mode 100644 index 00000000000..fabde2f9f38 --- /dev/null +++ b/patches/0077-Fix-spurious-JSON-diff-for-redrive_allow_policy.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: James Forcier +Date: Mon, 11 Nov 2024 16:12:57 -0500 +Subject: [PATCH] Fix spurious JSON diff for redrive_allow_policy + +This applies the same fix found in #2529 to the RedriveAllowPolicy +resource, which needs the same treatment. + +diff --git a/internal/service/sqs/queue_redrive_allow_policy.go b/internal/service/sqs/queue_redrive_allow_policy.go +index 7e3c390e50..789bb04619 100644 +--- a/internal/service/sqs/queue_redrive_allow_policy.go ++++ b/internal/service/sqs/queue_redrive_allow_policy.go +@@ -32,9 +32,10 @@ func resourceQueueRedriveAllowPolicy() *schema.Resource { + ForceNew: true, + }, + "redrive_allow_policy": { +- Type: schema.TypeString, +- Required: true, +- ValidateFunc: validation.StringIsJSON, ++ Type: schema.TypeString, ++ Required: true, ++ ValidateFunc: validation.StringIsJSON, ++ DiffSuppressFunc: verify.SuppressEquivalentJSONDiffs, + StateFunc: func(v interface{}) string { + json, _ := structure.NormalizeJsonString(v) + return json diff --git a/provider/provider_python_test.go b/provider/provider_python_test.go index 6732178ec45..9e35c86810f 100644 --- a/provider/provider_python_test.go +++ b/provider/provider_python_test.go @@ -104,6 +104,14 @@ func TestRegress4457(t *testing.T) { t.Logf("%s", previewResult.StdErr) } +func TestRegress4760(t *testing.T) { + ptest := pulumiTest(t, filepath.Join("test-programs", "regress-4760")) + upResult := ptest.Up(t) + t.Logf("#%v", upResult.Summary) + result := ptest.Preview(t, optpreview.ExpectNoChanges()) + t.Logf("#%v", result.ChangeSummary) +} + func getPythonBaseOptions(t *testing.T) integration.ProgramTestOptions { t.Helper() envRegion := getEnvRegion(t) diff --git a/provider/test-programs/regress-4760/.gitignore b/provider/test-programs/regress-4760/.gitignore new file mode 100644 index 00000000000..a3807e5bdbd --- /dev/null +++ b/provider/test-programs/regress-4760/.gitignore @@ -0,0 +1,2 @@ +*.pyc +venv/ diff --git a/provider/test-programs/regress-4760/Pulumi.yaml b/provider/test-programs/regress-4760/Pulumi.yaml new file mode 100644 index 00000000000..08c24186d7d --- /dev/null +++ b/provider/test-programs/regress-4760/Pulumi.yaml @@ -0,0 +1,10 @@ +name: regress-4760 +runtime: + name: python + options: + virtualenv: venv +description: Provision an SQS queue/DLQ to test RedriveAllowPolicy diffs +config: + pulumi:tags: + value: + pulumi:template: aws-python diff --git a/provider/test-programs/regress-4760/__main__.py b/provider/test-programs/regress-4760/__main__.py new file mode 100644 index 00000000000..751bedc0af8 --- /dev/null +++ b/provider/test-programs/regress-4760/__main__.py @@ -0,0 +1,24 @@ +import pulumi +from pulumi_aws import sqs + +dlq = sqs.Queue("demo-dlq") +queue = sqs.Queue( + "demo-queue", + redrive_policy=pulumi.Output.json_dumps( + { + "deadLetterTargetArn": dlq.arn, + "maxReceiveCount": 2, + } + ) +) + +redrive_allow_policy = sqs.RedriveAllowPolicy( + "demo", + queue_url=dlq.id, + redrive_allow_policy=pulumi.Output.json_dumps( + { + "redrivePermission": "byQueue", + "sourceQueueArns": [queue.arn], + } + ) +) diff --git a/provider/test-programs/regress-4760/requirements.txt b/provider/test-programs/regress-4760/requirements.txt new file mode 100644 index 00000000000..72aee7915e2 --- /dev/null +++ b/provider/test-programs/regress-4760/requirements.txt @@ -0,0 +1,2 @@ +pulumi>=3.0.0,<4.0.0 +pulumi-aws>=6.0.2,<7.0.0