Skip to content

Migrate cloudflare_zero_trust_access_application state from v5 to v6#1570

Merged
guineveresaenger merged 3 commits into
masterfrom
worktree-fix-zero-trust-access-application-1165
May 11, 2026
Merged

Migrate cloudflare_zero_trust_access_application state from v5 to v6#1570
guineveresaenger merged 3 commits into
masterfrom
worktree-fix-zero-trust-access-application-1165

Conversation

@guineveresaenger

@guineveresaenger guineveresaenger commented May 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a PreStateUpgradeHook that strips empty corsHeaders: [] and wraps string-array policies to [{id}] so v5 state decodes through the v6 bridge encoder.
  • Two tests: a recorded baseline and a hand-crafted state file covering the populated branches.

Fixes #1165.
Fixes #1284.

Test plan

  • TestZeroTrustAccessApplicationUpgrade passes (recorded baseline)
  • TestZeroTrustAccessApplicationFromState passes (hand-crafted populated state)
  • TestZeroTrustAccessApplicationVersionReminder passes

🤖 Generated with Claude Code

@guineveresaenger guineveresaenger requested a review from a team May 8, 2026 21:12
guineveresaenger and others added 2 commits May 8, 2026 14:13
Captures v5 (5.49.0) state for cloudflare:index:AccessApplication so the
upgrade path to v6 ZeroTrustAccessApplication can be tested. Recording
uses bookmark + accountId to sidestep the inactive shared test zone;
the migration logic is type-agnostic so any access-app state shape
exercises it.

Also tightens testProgram: skips with a clear message when
CLOUDFLARE_ACCOUNT_ID is unset (instead of silently failing with diff
noise from baked-in IDs in the recording), and reads cloudflare-domain
from CLOUDFLARE_DOMAIN env so the hardcoded pulumi-cloudflare-demo.com
default can be overridden.

See #1165.
v5 stored cors_headers as a list (ListNestedBlock) and policies as a
list of strings; v6 expects cors_headers as a single object and
policies as [{id}]. Without a PreStateUpgradeHook the bridge encoder
fails with `objectEncoder failed on property "cors_headers": Expected
an Object PropertyValue, found []`.

Adds the hook (resources.go), a version-reminder test
(resources_test.go) matching the pattern from #1549/#1172, and a
hand-crafted state file + TestZeroTrustAccessApplicationFromState that
exercises the populated-array branches (corsHeaders array → object,
policies string array → object array) which the recorded bookmark test
can't reach because Cloudflare normalizes those fields away for
bookmark-type apps.

Fixes #1165.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@guineveresaenger guineveresaenger force-pushed the worktree-fix-zero-trust-access-application-1165 branch from 233fb0a to 256a005 Compare May 8, 2026 21:13
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

Maintainer note: consult the runbook for dealing with any breaking changes.

@guineveresaenger guineveresaenger merged commit 7d1f0a9 into master May 11, 2026
21 checks passed
@guineveresaenger guineveresaenger deleted the worktree-fix-zero-trust-access-application-1165 branch May 11, 2026 17:10
@pulumi-bot

Copy link
Copy Markdown
Contributor

This PR has been shipped in release v6.16.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants