refactor: collapse cdn.tf pullzones into for_each #80
Loading…
Reference in a new issue
No description provided.
Delete branch "pr/cdn-tf-for-each"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The two
bunnynet_pullzoneresources (devxy-r-binaries/ cran.devxy.io andcran_rpkgs_com/ cran.rpkgs.com) and theirbunnynet_pullzone_hostnamesiblings were byte-for-byte identical except for the zone name and hostname.Collapses both into a
for_eachover alocal.pullzonesmap. Shared knobs (block_ips,limit_bandwidth,s3_auth_*,cache_*, …) now live in one place.Before applying
Resource addresses change:
bunnynet_pullzone.devxy-r-binariesbunnynet_pullzone.this["cran"]bunnynet_pullzone.cran_rpkgs_combunnynet_pullzone.this["cran-rpkgs"]bunnynet_pullzone_hostname.devxy-r-binariesbunnynet_pullzone_hostname.this["cran"]bunnynet_pullzone_hostname.cran_rpkgs_combunnynet_pullzone_hostname.this["cran-rpkgs"]The PR includes
moved {}blocks for each, soterraform planshould report zero in-place / destroy / create for the four resources — just state shuffling.Verify before applying:
Output should show four
Move from ... to ...notices and zero+/-/~for the pullzones/hostnames. If anything else changes, abort.Follow-up
Once a successful apply has run on every workspace, the
moved {}blocks can be removed in a follow-up commit (they're a no-op after migration).bunnynet_pullzone.devxy-r-binaries (cran.devxy.io) and bunnynet_pullzone.cran_rpkgs_com (cran.rpkgs.com) were byte-for-byte identical except for the zone name and hostname. Same for the two pullzone_hostname resources. Use a single local.pullzones map and for_each on both resources, so shared knobs (block_ips, limit_bandwidth, s3_auth_*, ...) only have to be edited once. State migration is handled by moved {} blocks so the existing pullzones get re-addressed under the new for_each keys instead of being destroyed+recreated. Run terraform plan to confirm a zero- change apply before applying.Closing — the duplication this PR was solving no longer exists.
In
44482b1thebunnynet_pullzone.devxy-r-binaries(cran.devxy.io) and its hostname + storage zone were commented out, and the survivingcran_rpkgs_comresource has since diverged with new fields (middleware_script,routing { filters },cache_expiration_time,websockets_enabled,errorpage_whitelabel,cache_errors = false, …) that the deleted resource never had.A future
for_eachrefactor (if more pullzones come back) should be designed against the new shape, not this one. Closing as obsolete.Pull request closed