Skip to content

feat(terraform/cloudflare): migrate Cloudflare provider v4 to v5 (BOXP-122) - #11342

Merged
boxp merged 97 commits into
mainfrom
codex-task-board/BOXP-122-20260721T094425Z-442d8200-2ba2-4b0f-ab6c-df9950826c63
Jul 23, 2026
Merged

feat(terraform/cloudflare): migrate Cloudflare provider v4 to v5 (BOXP-122)#11342
boxp merged 97 commits into
mainfrom
codex-task-board/BOXP-122-20260721T094425Z-442d8200-2ba2-4b0f-ab6c-df9950826c63

Conversation

@boxp

@boxp boxp commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

Cloudflare Terraform provider を v4.52 から v5 にアップグレードする。

変更内容

  • provider バージョン: 全モジュールで ~> 4.52 から ~> 5.0 に更新
  • リソースリネーム: v4 から v5 の破壊的変更に対応
  • moved ブロック: 各モジュールに moved.tf を追加して tfstate を引き継ぐ
  • page_rule 廃止: cloudflare_ruleset (phase=http_request_redirect) に移行
  • grafana/dns.tf: value 属性を content に修正

テスト計画

  • 各モジュールで terraform init -upgrade が成功すること
  • 各モジュールで terraform plan がエラーなく完了すること(tfaction CI 経由で確認)
  • moved ブロックにより既存リソースの destroy/recreate が発生しないこと

Closes BOXP-122

- Update all provider version constraints from ~> 4.52 to ~> 5.0
- Rename v4 resources to v5 equivalents:
  cloudflare_record to cloudflare_dns_record
  cloudflare_access_application to cloudflare_zero_trust_access_application
  cloudflare_access_policy to cloudflare_zero_trust_access_policy
  cloudflare_access_service_token to cloudflare_zero_trust_access_service_token
  cloudflare_tunnel to cloudflare_zero_trust_tunnel_cloudflared
  cloudflare_tunnel_config to cloudflare_zero_trust_tunnel_cloudflared_config
- Add moved.tf blocks for state migration in each module
- Replace cloudflare_page_rule with cloudflare_ruleset (http_request_redirect)
- Fix grafana dns.tf: value attribute to content

Closes BOXP-122

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@boxp-tfaction

This comment has been minimized.

@boxp-tfaction

This comment has been minimized.

@boxp-tfaction

This comment has been minimized.

@boxp-tfaction

This comment has been minimized.

This was referenced Jul 23, 2026
boxp pushed a commit that referenced this pull request Jul 28, 2026
…source (BOXP-135)

The v4→v5 provider migration (PR #11342) removed
cloudflare_zero_trust_tunnel_route.codex_workspace from state via
tfmigrate but never imported the v5 equivalent, causing every apply to
attempt creating the 192.168.10.98/32 route and receive a 409 Conflict
from Cloudflare (error 1014: route already exists).

Fix: add a cloudflare_zero_trust_tunnel_cloudflared_route data source
filtered by network_subset/superset to look up the existing route UUID,
then use an import block to bring it into state under the v5 resource
name. The data source exists in provider v5.22.0 (confirmed via
provider.go registration).

After a successful apply the import block becomes a no-op; a follow-up
PR can remove the data source and import block.

Closes follow-up PRs: #11621, #11675

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
boxp added a commit that referenced this pull request Jul 28, 2026
…source (BOXP-135) (#11700)

The v4→v5 provider migration (PR #11342) removed
cloudflare_zero_trust_tunnel_route.codex_workspace from state via
tfmigrate but never imported the v5 equivalent, causing every apply to
attempt creating the 192.168.10.98/32 route and receive a 409 Conflict
from Cloudflare (error 1014: route already exists).

Fix: add a cloudflare_zero_trust_tunnel_cloudflared_route data source
filtered by network_subset/superset to look up the existing route UUID,
then use an import block to bring it into state under the v5 resource
name. The data source exists in provider v5.22.0 (confirmed via
provider.go registration).

After a successful apply the import block becomes a no-op; a follow-up
PR can remove the data source and import block.

Closes follow-up PRs: #11621, #11675

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant