feat: add cloudflare_healthcheck v4 to v5 migration#46
Merged
Conversation
ba2fb86 to
e18d163
Compare
Implements complete migration for cloudflare_healthcheck resource from v4 to v5. **Major Changes:** - Pattern 0 migration: Flat structure → Nested attributes (http_config/tcp_config) - HTTP/HTTPS fields moved into http_config nested attribute - TCP fields moved into tcp_config nested attribute - Headers transformed from Set to Map structure - Numeric fields converted from Int to Float64 **Implementation:** 1. **Helper Functions** (internal/transform/hcl/attributes.go): - CreateNestedAttributeFromFields(): Creates nested attributes from field maps - MoveAttributesToNestedObject(): Moves multiple attributes into nested objects 2. **Migration Logic** (internal/resources/healthcheck/v4_to_v5.go): - TransformConfig(): Handles HCL configuration transformations - TransformState(): Handles JSON state transformations - transformToHTTPConfig(): Creates http_config for HTTP/HTTPS types - transformToTCPConfig(): Creates tcp_config for TCP type - buildHeaderMapTokens(): Converts header blocks to map format 3. **Tests** (internal/resources/healthcheck/): - v4_to_v5_test.go: 19 unit tests (70.3% coverage) - integration_state_test.go: 3 integration tests (30 instances) 4. **Integration Test Data** (integration/v4_to_v5/testdata/healthcheck/): - input/: 28 v4 resource configurations (525 lines) - expected/: Generated v5 output for validation 5. **CLI Registration** (cmd/tf-migrate/main.go): - Import healthcheck migrator for automatic registration **Test Results:** - ✅ All 19 unit tests passing - ✅ All 30 integration instances transforming successfully - ✅ CLI tool successfully migrates both config and state files - ✅ 100% success rate on test data **Validation:** - State transformation: Production ready - Config transformation: Complete and working - Complex transformations: Headers, nested attributes, type conversions all working Co-Authored-By: Claude <noreply@anthropic.com>
b58a910 to
f231be1
Compare
SirCortly
approved these changes
Dec 5, 2025
asvh01
approved these changes
Dec 8, 2025
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.
Implements complete migration for cloudflare_healthcheck resource from v4 to v5.
Major Changes:
Implementation:
Helper Functions (internal/transform/hcl/attributes.go):
Migration Logic (internal/resources/healthcheck/v4_to_v5.go):
Tests (internal/resources/healthcheck/):
Integration Test Data (integration/v4_to_v5/testdata/healthcheck/):
CLI Registration (cmd/tf-migrate/main.go):
Test Results:
Validation: