chore(cloudflare)!: upgrade Terraform provider version

It's a breaking change due to a known oversight in the 3.x -> 4.x
migration.

https://github.com/cloudflare/terraform-provider-cloudflare/issues/2286

To resolve you can either:

1. Manually update the state file with the new resource name
2. Remove the resources from state, perform the upgrade and then
   reimport the resources back into the state
3. (What I did, but you'll have downtime) Comment out the tunnel
   resources, apply, bump the version to v4, uncomment, then apply again
   to recreate the resources
This commit is contained in:
Khue Doan 2024-04-18 16:59:17 +07:00
parent 295914cfae
commit 20b4f10976
3 changed files with 6 additions and 6 deletions

View File

@ -9,7 +9,7 @@ resource "random_password" "tunnel_secret" {
special = false
}
resource "cloudflare_argo_tunnel" "homelab" {
resource "cloudflare_tunnel" "homelab" {
account_id = var.cloudflare_account_id
name = "homelab"
secret = base64encode(random_password.tunnel_secret.result)
@ -20,7 +20,7 @@ resource "cloudflare_record" "tunnel" {
zone_id = data.cloudflare_zone.zone.id
type = "CNAME"
name = "homelab-tunnel"
value = "${cloudflare_argo_tunnel.homelab.id}.cfargotunnel.com"
value = "${cloudflare_tunnel.homelab.id}.cfargotunnel.com"
proxied = false
ttl = 1 # Auto
}
@ -38,8 +38,8 @@ resource "kubernetes_secret" "cloudflared_credentials" {
data = {
"credentials.json" = jsonencode({
AccountTag = var.cloudflare_account_id
TunnelName = cloudflare_argo_tunnel.homelab.name
TunnelID = cloudflare_argo_tunnel.homelab.id
TunnelName = cloudflare_tunnel.homelab.name
TunnelID = cloudflare_tunnel.homelab.id
TunnelSecret = base64encode(random_password.tunnel_secret.result)
})
}

View File

@ -2,7 +2,7 @@ terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 3.35.0"
version = "~> 4.30.0"
}
kubernetes = {

View File

@ -13,7 +13,7 @@ terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 3.35.0"
version = "~> 4.30.0"
}
kubernetes = {