feat: add cloudflare_worker_secret migration support - #320
Merged
Conversation
Adds v4-to-v5 migration for cloudflare_workers_secret and the deprecated cloudflare_worker_secret resources. In v5, standalone worker secrets no longer exist; they are managed as secret_text bindings on the cloudflare_workers_script resource. Migration behavior: - Cross-resource merge: secrets are automatically folded into their parent workers_script bindings list when both are in the same file - Existing bindings preserved via concat() - Parent matching by resource reference or literal script_name - Orphan secrets (parent not in file) get removed block + diagnostic - PhaseOneTransformer implemented for two-phase migration (required because the v5 provider has no schema for workers_secret) Handles both cloudflare_workers_secret (plural) and cloudflare_worker_secret (singular/deprecated) identically. Ref: APIX-1259
The v5 provider has no schema for cloudflare_workers_secret or cloudflare_worker_secret. The E2E runner must remove these state entries before running terraform init/plan with the v5 provider, matching the existing pattern for zone_settings_override and split_tunnel.
…overage - Add drift exemptions targeting cloudflare_workers_script (not cloudflare_workers_secret) since secrets are folded into script bindings - Suppress resource_type mismatch warning when resource_name_patterns provides intentional cross-resource scoping - Fix diagnostic: replace incorrect 'terraform state rm' instruction with note about removed block handling state cleanup - Add redeployment behavior note to diagnostic warning - Harden concat() append with suffix validation - Add idempotency test for ProcessCrossResourceConfigMigration - Add diagnostic content test - Fix import ordering in registry.go - Remove README.md (docs belong in provider migration guides)
ssicard
marked this pull request as ready for review
July 16, 2026 21:53
vaishakdinesh
approved these changes
Aug 5, 2026
mgirouard
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds v4-to-v5 migration for
cloudflare_workers_secretand the deprecatedcloudflare_worker_secretresources. In v5, standalone worker secrets no longer exist -- they are managed assecret_textbindings on thecloudflare_workers_scriptresource.Migration behavior
cloudflare_workers_secret(plural) andcloudflare_worker_secret(singular/deprecatedworkers_scriptbindings list when both are in the same file)Output of migrations hows a warning, since a deletion occurs:
E2E Test Results