Skip to content

feat: preserve cluster tunnel lifecycle - #36

Merged
xnoto merged 1 commit into
mainfrom
feat/persist-cluster-tunnel
Aug 28, 2026
Merged

feat: preserve cluster tunnel lifecycle#36
xnoto merged 1 commit into
mainfrom
feat/persist-cluster-tunnel

Conversation

@xnoto

@xnoto xnoto commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • import the live cluster-apps-k3s tunnel into OpenTofu as a durable, locally configured resource
  • protect the tunnel from accidental Terraform destruction
  • retain Terraform ownership of only the api and k3s bootstrap CNAMEs
  • document the boundary with cloudflare-operator local routes and workload DNS

Migration

The import block adopts the existing tunnel ID; it must not create or replace the tunnel. Merge and allow the environment-gated OpenTofu apply to finish before merging the companion Kustomize PR.

Companion: makeitworkcloud/kustomize-cluster#105

Validation

  • tofu validate -no-color
  • all local pre-commit hooks passed, including TFLint, Checkov, formatting, generated Terraform docs, and secret detection
  • live tunnel is healthy and configured with config_src=local

@github-actions

Copy link
Copy Markdown
Contributor

OpenTofu CI passed

View the workflow run.

Validation output (redacted, last 12000 characters)

Terraform validate.......................................................Passed
Terraform validate with tflint...........................................Passed
Checkov..................................................................Passed
Terraform fmt............................................................Passed
Terraform docs...........................................................Passed
Detect hardcoded secrets.................................................Passed
check for case conflicts.................................................Passed
check for merge conflicts................................................Passed
check for broken symlinks............................(no files to check)Skipped
check vcs permalinks.....................................................Passed
detect destroyed symlinks................................................Passed
detect private key.......................................................Passed
fix end of files.........................................................Passed
mixed line ending........................................................Passed
trim trailing whitespace.................................................Passed
don't commit to branch..................................................Skipped
check for added large files..............................................Passed

@github-actions

Copy link
Copy Markdown
Contributor

OpenTofu Plan

OpenTofu will perform the following actions:

  # cloudflare_zero_trust_tunnel_cloudflared.cluster_apps will be imported
  # (imported from "03f750691b4ad4d59aa4b7205adaa108/d17bee03-8687-46a7-831b-df48aacdea1e")
    resource "cloudflare_zero_trust_tunnel_cloudflared" "cluster_apps" {
        account_id      = (sensitive value)
        account_tag     = "03f750691b4ad4d59aa4b7205adaa108"
        config_src      = "local"
        connections     = [
            {
                client_id      = "0ec2ed32-dd95-4702-aebd-fe37255b45a7"
                client_version = "2026.8.2"
                colo_name      = "mci01"
                id             = "05144ccd-c031-494d-b20a-47063be95fc6"
                opened_at      = "2026-08-28T15:46:57Z"
                origin_ip      = "98.97.1.104"
                uuid           = "05144ccd-c031-494d-b20a-47063be95fc6"
            },
            {
                client_id      = "0ec2ed32-dd95-4702-aebd-fe37255b45a7"
                client_version = "2026.8.2"
                colo_name      = "den03"
                id             = "664a3450-a575-41ce-9523-b8173c4485ae"
                opened_at      = "2026-08-28T15:46:57Z"
                origin_ip      = "98.97.1.104"
                uuid           = "664a3450-a575-41ce-9523-b8173c4485ae"
            },
            {
                client_id      = "0ec2ed32-dd95-4702-aebd-fe37255b45a7"
                client_version = "2026.8.2"
                colo_name      = "mci03"
                id             = "034767d8-e240-4876-be60-4ffa4c0b5042"
                opened_at      = "2026-08-28T15:46:58Z"
                origin_ip      = "98.97.1.104"
                uuid           = "034767d8-e240-4876-be60-4ffa4c0b5042"
            },
            {
                client_id      = "0ec2ed32-dd95-4702-aebd-fe37255b45a7"
                client_version = "2026.8.2"
                colo_name      = "den01"
                id             = "e77c85ae-85c4-49e1-be3f-2413245d27fa"
                opened_at      = "2026-08-28T15:46:59Z"
                origin_ip      = "98.97.1.104"
                uuid           = "e77c85ae-85c4-49e1-be3f-2413245d27fa"
            },
        ]
        conns_active_at = "2026-08-28T15:46:55Z"
        created_at      = "2026-08-28T06:25:41Z"
        id              = "d17bee03-8687-46a7-831b-df48aacdea1e"
        metadata        = jsonencode({})
        name            = "cluster-apps-k3s"
        remote_config   = false
        status          = "healthy"
        tun_type        = "cfd_tunnel"
    }

Plan: 1 to import, 0 to add, 0 to change, 0 to destroy.
������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
OpenTofu will perform the following actions:

  # cloudflare_zero_trust_tunnel_cloudflared.cluster_apps will be imported
  # (imported from "03f750691b4ad4d59aa4b7205adaa108/d17bee03-8687-46a7-831b-df48aacdea1e")
    resource "cloudflare_zero_trust_tunnel_cloudflared" "cluster_apps" {
        account_id      = (sensitive value)
        account_tag     = "03f750691b4ad4d59aa4b7205adaa108"
        config_src      = "local"
        connections     = [
            {
                client_id      = "0ec2ed32-dd95-4702-aebd-fe37255b45a7"
                client_version = "2026.8.2"
                colo_name      = "mci01"
                id             = "05144ccd-c031-494d-b20a-47063be95fc6"
                opened_at      = "2026-08-28T15:46:57Z"
                origin_ip      = "98.97.1.104"
                uuid           = "05144ccd-c031-494d-b20a-47063be95fc6"
            },
            {
                client_id      = "0ec2ed32-dd95-4702-aebd-fe37255b45a7"
                client_version = "2026.8.2"
                colo_name      = "den03"
                id             = "664a3450-a575-41ce-9523-b8173c4485ae"
                opened_at      = "2026-08-28T15:46:57Z"
                origin_ip      = "98.97.1.104"
                uuid           = "664a3450-a575-41ce-9523-b8173c4485ae"
            },
            {
                client_id      = "0ec2ed32-dd95-4702-aebd-fe37255b45a7"
                client_version = "2026.8.2"
                colo_name      = "mci03"
                id             = "034767d8-e240-4876-be60-4ffa4c0b5042"
                opened_at      = "2026-08-28T15:46:58Z"
                origin_ip      = "98.97.1.104"
                uuid           = "034767d8-e240-4876-be60-4ffa4c0b5042"
            },
            {
                client_id      = "0ec2ed32-dd95-4702-aebd-fe37255b45a7"
                client_version = "2026.8.2"
                colo_name      = "den01"
                id             = "e77c85ae-85c4-49e1-be3f-2413245d27fa"
                opened_at      = "2026-08-28T15:46:59Z"
                origin_ip      = "98.97.1.104"
                uuid           = "e77c85ae-85c4-49e1-be3f-2413245d27fa"
            },
        ]
        conns_active_at = "2026-08-28T15:46:55Z"
        created_at      = "2026-08-28T06:25:41Z"
        id              = "d17bee03-8687-46a7-831b-df48aacdea1e"
        metadata        = jsonencode({})
        name            = "cluster-apps-k3s"
        remote_config   = false
        status          = "healthy"
        tun_type        = "cfd_tunnel"
    }

Plan: 1 to import, 0 to add, 0 to change, 0 to destroy.

@xnoto
xnoto merged commit 358c053 into main Aug 28, 2026
4 checks passed
@xnoto
xnoto deleted the feat/persist-cluster-tunnel branch August 28, 2026 20:58
xnoto added a commit to makeitworkcloud/kustomize-cluster that referenced this pull request Aug 28, 2026
## Summary
- persist the current tunnel credential in the existing SOPS-managed
Cloudflare Secret
- switch `ClusterTunnel/cluster-apps` from `newTunnel` to
`existingTunnel`
- reference the durable tunnel by both ID and name
- document the Terraform/Argo ownership boundary

## Ordering
Do not merge until the companion Terraform PR has merged and its
OpenTofu apply has imported the tunnel successfully. After sync, remove
the stale `newTunnel` finalizer and repair the current workload
ownership TXT records.

Companion: makeitworkcloud/tfroot-cloudflare#36

## Validation
- rendered the complete Cloudflare operator Kustomization with KSOPS
- verified the rendered credential document matches the existing tunnel
without displaying secret values
- all local pre-commit, YAML, secret-detection, and KubeLinter checks
passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant