Add Local Provider Testing Support for Migration E2E Tests & improve integration tests#47
Merged
tamas-jozsa merged 3 commits intomainfrom Dec 2, 2025
Merged
Add Local Provider Testing Support for Migration E2E Tests & improve integration tests#47tamas-jozsa merged 3 commits intomainfrom
tamas-jozsa merged 3 commits intomainfrom
Conversation
d698e73 to
bea7621
Compare
tamas-jozsa
commented
Nov 28, 2025
| @@ -1,218 +1,19 @@ | |||
| # Integration Test for cloudflare_logpull_retention v4 → v5 Migration | |||
Collaborator
Author
There was a problem hiding this comment.
there is no point in having complex test cases for this very simple resource, so I cleaned them up
mgirouard
approved these changes
Dec 1, 2025
bb701f9 to
6b67cdd
Compare
…osture migration This commit fixes two critical drift issues in the zero_trust_device_posture_rule v4 to v5 migration: 1. Schedule field drift (affected 14 resources) - Removed logic that deleted schedule = "5m" from state - The v5 provider returns this value from API, so removing it caused drift - Now preserved in state to match v5 API behavior 2. Match blocks with dynamic references (affected 5+ resources) - Fixed MergeAttributeAndBlocksToObjectArray to preserve dynamic references - Previously, match blocks with each.value.platform or var.platform were completely removed - Added extractTokensFromBlock helper to preserve HCL tokens (variables, interpolations, functions) - Now correctly transforms match blocks to arrays while preserving dynamic expressions Additional changes: - Added 3 unit tests for match blocks with dynamic references - Updated integration testdata to include preserved schedule and match arrays - Added E2E test Step 4 to verify stable state after v5 apply - E2E script now exits with error if ongoing drift is detected 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add ability to test migrations with locally built provider binary, and
update test data to reflect current provider behavior.
Changes:
- Add --provider flag to run-e2e-tests script for local provider testing
- Verifies provider binary exists before running tests
- Creates .terraformrc-tf-migrate with dev_overrides automatically
- Applies dev overrides only to v5 tests (v4 uses registry provider)
- Update zero_trust_gateway_policy migration logic for v5 schema changes
- Update test expectations for logpull_retention, zero_trust_gateway_policy,
and zero_trust_list to match current provider output
The --provider flag enables rapid iteration when fixing provider issues:
./scripts/run-e2e-tests --provider /path/to/cloudflare-terraform-next
This allows testing provider fixes during migration without waiting for
provider releases, while keeping v4 tests using stable registry versions.
6b67cdd to
2730fc1
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.
Summary
This PR adds the ability to test v4→v5 migrations with a locally built
provider binary, enabling rapid iteration when fixing provider issues
discovered during migration testing. Additionally includes updated test
expectations to match current provider behavior.
Motivation
During migration testing, we discovered several provider issues causing
drift:
input.versionnot being persisted(known after apply)Previously, testing provider fixes required:
This was slow and cumbersome for iterative development.
Changes
1. Local Provider Testing Support
New Feature:
--providerflag forrun-e2e-testsscriptHow it works:
compatibility)
Benefits:
2. Migration Logic Updates
File: internal/resources/zero_trust_gateway_policy/v4_to_v5.go
Updated migration logic to handle v5 provider schema changes for gateway
policies.
3. Test Data Updates
Updated test expectations for resources that changed behavior:
Usage Examples
Test with local provider: