fix(zone): rewrite cross-file .zone references to .name#295
Merged
vaishakdinesh merged 1 commit intomainfrom May 7, 2026
Merged
fix(zone): rewrite cross-file .zone references to .name#295vaishakdinesh merged 1 commit intomainfrom
vaishakdinesh merged 1 commit intomainfrom
Conversation
The cloudflare_zone resource renamed its 'zone' attribute to 'name' in v5, but tf-migrate only updated it within the resource block. Cross-file references like cloudflare_zone.example.zone were left unchanged, breaking any resource that referenced the zone's domain. Add ComputedAttributeMapper to the zone migrator so that all cross-file references to .zone are rewritten to .name during global postprocessing. Fixes references in string interpolations, locals, and other resources. Found via review of cloudflare/ops/terraform-cfaccounts MR !9482.
8827ec0 to
ee3741e
Compare
Member
Author
musa-cf
approved these changes
May 7, 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
ComputedAttributeMapperto thecloudflare_zonemigrator so that cross-file references likecloudflare_zone.example.zoneare rewritten tocloudflare_zone.example.nameduring migrationzone→nameattribute rename was handled within the resource block, but cross-file references were left unchanged — breaking any resource referencing the zone's domainContext
Found while reviewing terraform-cfaccounts MR !9482 where a customer had to manually fix
.zone→.namereferences inworkers_toolbox.tf. Related to APIX-741.Changes
internal/resources/zone/v4_to_v5.go— ImplementsComputedAttributeMapperinterface withzone→namemappingintegration/v4_to_v5/testdata/zone/input/zone_cross_refs.tf— New test file with cross-file.zonereferences (direct, interpolation, locals)integration/v4_to_v5/testdata/zone/expected/zone_cross_refs.tf— Expected output with.namereferencesTesting