feat(pages_domain): convert tf-migrate logic to state upgraders#144
Open
rotem-cloud wants to merge 2 commits intomainfrom
Open
feat(pages_domain): convert tf-migrate logic to state upgraders#144rotem-cloud wants to merge 2 commits intomainfrom
rotem-cloud wants to merge 2 commits intomainfrom
Conversation
77aa78d to
58f0cf8
Compare
vaishakdinesh
approved these changes
Feb 13, 2026
ea9f538 to
07c4c33
Compare
07c4c33 to
5a1b833
Compare
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.
E2E Test Summary:
Configuring remote backend...
✓ Backend configured
✓ Provider installation preserved
✓ Backend already configured
Next steps:
cd tf/v4 && terraform apply
Note: Configuration is automatically loaded from terraform.tfvars
State is managed remotely in R2
✓ Test resources initialized
========================================
Setting up local provider
Using provider from: /Users/rotematzaba/cf-repos/terraform-devstack/cloudflare-terraform-next/terraform-provider-cloudflare
Building provider...
Building in: /Users/rotematzaba/cf-repos/terraform-devstack/cloudflare-terraform-next
Output: /Users/rotematzaba/cf-repos/terraform-devstack/cloudflare-terraform-next/terraform-provider-cloudflare
✓ Provider built successfully: /Users/rotematzaba/cf-repos/terraform-devstack/cloudflare-terraform-next/terraform-provider-cloudflare
✓ Created dev overrides config: /Users/rotematzaba/Documents/gitRepos/terraform-devstack/tf-migrate/.terraformrc-tf-migrate
✓ Local provider will be used for v5 testing
Note: v4 tests will use the registry provider (v4.x)
v5 tests will use the local provider with dev overrides
Step 1: Testing v4 configurations
Running terraform init in v4/...
Found local state file, backing up and using remote state...
✓ Terraform init successful (remote state loaded from R2)
Running terraform plan in v4/...
✓ Terraform plan shows no changes
Running terraform apply in v4/...
✓ Terraform apply successful
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Syncing state from remote...
✓ Local state file synced from R2
Capturing v4 state...
✓ Saved v4 state to tmp/v4-state.json
Step 2: Running migration
Running ./scripts/migrate...
Building tf-migrate binary...
✓ Binary built successfully
========================================
Running v4 to v5 Migration
Preparing output directory...
✓ Preserved v5 provider installation (.terraform/)
✓ Preserved v5 dependency lock file (.terraform.lock.hcl)
Copying only targeted resources: pages_domain
✓ Copied root file: provider.tf
✓ Copied root file: terraform.tfvars
✓ Copied root file: terraform.tfstate
Creating filtered main.tf...
✓ Copied targeted resources to migrated-v4_to_v5/
✓ Updated provider.tf to use ~> 5.0 and removed backend config
Filtering state file to only include targeted resources...
✓ Filtered state to 14 resources from targeted modules
Migrating configuration files...
Skipping state transformation - using provider's state upgrader
Cloudflare Terraform Provider Migration Tool
Configuration directory: /Users/rotematzaba/Documents/gitRepos/terraform-devstack/tf-migrate/e2e/migrated-v4_to_v5
Output directory: in-place
✓ Using Cloudflare API credentials (API key + email)
Found 4 configuration files to migrate
[1/4] Processing main.tf... ✓
[2/4] Processing pages_domain.tf... ✓
[3/4] Processing versions.tf... ✓
[4/4] Processing provider.tf... ✓
2026-02-27T10:55:51.557-0600 [WARN] tf-migrate: Migrator does not implement ResourceRenamer interface - cross-file references may not be updated: migrator="*rulesets.V4ToV5Migrator"
2026-02-27T10:55:51.557-0600 [WARN] tf-migrate: Migrator does not implement ResourceRenamer interface - cross-file references may not be updated: migrator="*queue.V4ToV5Migrator"
2026-02-27T10:55:51.558-0600 [WARN] tf-migrate: Migrator does not implement ResourceRenamer interface - cross-file references may not be updated: migrator="*load_balancer_pools.V4ToV5Migrator"
2026-02-27T10:55:51.558-0600 [WARN] tf-migrate: Migrator does not implement ResourceRenamer interface - cross-file references may not be updated: migrator="*zero_trust_split_tunnel.V4ToV5Migrator"
2026-02-27T10:55:51.558-0600 [WARN] tf-migrate: Migrator does not implement ResourceRenamer interface - cross-file references may not be updated: migrator="*zero_trust_gateway_certificate.V4ToV5Migrator"
2026-02-27T10:55:51.558-0600 [WARN] tf-migrate: Migrator does not implement ResourceRenamer interface - cross-file references may not be updated: migrator="*zone_setting.V4ToV5Migrator"
Applying cross-file reference updates (29 updates across 4 files)...
✓ Updated cross-file references (29 updates applied)
✓ Migration complete (config transformed, state will be upgraded by provider)
========================================
✓ Migration Complete!
Results:
Input (v4): /Users/rotematzaba/Documents/gitRepos/terraform-devstack/tf-migrate/e2e/tf/v4
Output (v5): /Users/rotematzaba/Documents/gitRepos/terraform-devstack/tf-migrate/e2e/migrated-v4_to_v5
Next steps:
cd /Users/rotematzaba/Documents/gitRepos/terraform-devstack/tf-migrate/e2e/migrated-v4_to_v5
terraform init
terraform plan
✓ Migration successful
Step 3: Testing v5 configurations
Running terraform init in migrated-v4_to_v5/...
Cleaning v5 .terraform directory for fresh init...
Removing .terraform.lock.hcl to allow dev_overrides...
✓ Terraform init successful
Running terraform plan in v5/...
✓ Terraform plan shows no changes (expected)
Running terraform apply in v5/...
✓ Terraform apply successful
Capturing v5 state...
✓ Saved v5 state to tmp/v5-state.json
Step 4: Verifying stable state (v5 plan after apply)
Running terraform plan again to check for ongoing drift...
✓ No ongoing drift detected - migration achieved stable state!
========================================
✓ E2E Test Complete!
Summary:
Step 1: v4 terraform apply
Status: ✓ SUCCESS
Step 2: Migration (v4 → v5)
Status: ✓ SUCCESS
Step 3: v5 plan (before apply)
Status: ✓ No changes needed
Step 4: v5 terraform apply
Status: ✓ SUCCESS
Step 5: v5 plan (after apply)
Status: ✓ SUCCESS - Stable state achieved
Result: No changes detected