fix(terraform/cloudflare/k8s): import existing tunnel route via data source (BOXP-135) - #11700
Merged
boxp merged 1 commit intoJul 28, 2026
Conversation
This was referenced 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
force-pushed
the
codex-task-board/BOXP-135-20260728T071919Z-6d118ceb-3ff4-491b-8484-404da83e2d8a
branch
from
July 28, 2026 07:38
766f812 to
fd9154e
Compare
Contributor
Plan Result (terraform/cloudflare/b0xp.io/k8s)
Change Result (Click me) # cloudflare_zero_trust_device_default_profile.warp_include will be updated in-place
~ resource "cloudflare_zero_trust_device_default_profile" "warp_include" {
id = "1984a4314b3e75f3bedce97c7a8e0c81"
~ policy_id = "0197d1b3-fe50-7488-8b3d-55f27f26ea8b" -> (known after apply)
# (20 unchanged attributes hidden)
}
# cloudflare_zero_trust_tunnel_cloudflared_route.codex_workspace will be imported
resource "cloudflare_zero_trust_tunnel_cloudflared_route" "codex_workspace" {
account_id = "1984a4314b3e75f3bedce97c7a8e0c81"
comment = "lolice codex-workspace LoadBalancer for WARP access"
created_at = "2026-05-29T12:29:24Z"
id = "6b22520e-ad37-4864-8e43-842ff88fa48a"
network = "192.168.10.98/32"
tunnel_id = "0eb241e1-1295-4672-8285-f18241a38210"
virtual_network_id = "9bcd88ee-63e3-476b-bf2a-0f685c18cdd6"
}
Plan: 1 to import, 0 to add, 1 to change, 0 to destroy.
Warning: Redundant ignore_changes element
on tunnel.tf line 12, in resource "cloudflare_zero_trust_tunnel_cloudflared_config" "k8s_tunnel":
12: resource "cloudflare_zero_trust_tunnel_cloudflared_config" "k8s_tunnel" {
Adding an attribute name to ignore_changes tells Terraform to ignore future
changes to the argument in configuration after the object has been created,
retaining the value originally configured.
The attribute created_at is decided by the provider alone and therefore there
can be no configured value to compare with. Including this attribute in
ignore_changes has no effect. Remove the attribute from ignore_changes to
quiet this warning.
(and one more similar warning elsewhere)
|
boxp
deleted the
codex-task-board/BOXP-135-20260728T071919Z-6d118ceb-3ff4-491b-8484-404da83e2d8a
branch
July 28, 2026 08:19
Contributor
✅ Apply Succeeded (terraform/cloudflare/b0xp.io/k8s)Details (Click me)Jul 28 08:20:54.016 WRN The policy file is ignored unless it is allowed by "aqua policy allow" command.
$ aqua policy allow "/home/runner/work/arch/arch/aqua/aqua-policy.yaml"
If you want to keep ignoring the policy file without the warning, please run "aqua policy deny" command.
$ aqua policy deny "/home/runner/work/arch/arch/aqua/aqua-policy.yaml"
program=aqua version=2.62.1 env=linux/amd64 exe_name=terraform package_name=hashicorp/terraform package_version=v1.15.8 registry=standard policy_file=/home/runner/work/arch/arch/aqua/aqua-policy.yaml doc=https://aquaproj.github.io/docs/reference/codes/003
cloudflare_zero_trust_tunnel_cloudflared_route.codex_workspace: Importing... [id=1984a4314b3e75f3bedce97c7a8e0c81/6b22520e-ad37-4864-8e43-842ff88fa48a]
cloudflare_zero_trust_tunnel_cloudflared_route.codex_workspace: Import complete [id=1984a4314b3e75f3bedce97c7a8e0c81/6b22520e-ad37-4864-8e43-842ff88fa48a]
cloudflare_zero_trust_device_default_profile.warp_include: Modifying... [id=1984a4314b3e75f3bedce97c7a8e0c81]
cloudflare_zero_trust_device_default_profile.warp_include: Modifications complete after 0s [id=1984a4314b3e75f3bedce97c7a8e0c81]
Apply complete! Resources: 1 imported, 0 added, 1 changed, 0 destroyed.
|
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
terraform/cloudflare/b0xp.io/k8sで apply のたびに 409 Conflict (error 1014: You already have a route defined for this exact IP subnet) が発生し、tfaction が follow-up PR (chore(terraform/cloudflare/b0xp.io/k8s): follow up #11614 #11621, chore(terraform/cloudflare/b0xp.io/k8s): follow up #11668 #11675) を自動生成し続けていた問題を修正cloudflare_zero_trust_tunnel_route.codex_workspaceを state から削除したが、v5 の新リソース名cloudflare_zero_trust_tunnel_cloudflared_route.codex_workspaceを import する処理が欠落していたcloudflare_zero_trust_tunnel_cloudflared_routedata source (v5.22.0 に存在) を使って既存 route の UUID を検索し、HCL import ブロックで state に取り込むChanges
terraform/cloudflare/b0xp.io/k8s/tunnel.tf: data source + import ブロック追加docs/project_docs/BOXP-135/plan.md: 調査・修正計画ドキュメントHow It Works
data "cloudflare_zero_trust_tunnel_cloudflared_route" "codex_workspace"がnetwork_subset = network_superset = "192.168.10.98/32"でフィルタリングし、Cloudflare API から既存 route の UUID を取得importブロックが{account_id}/{route_uuid}形式で route を Terraform state に取り込むTest Plan
References
🤖 Generated with Claude Code