Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ You will need to declare the [providers](https://registry.terraform.io/browse/pr
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = ">= 4.39.0"
version = ">= 4.40.0"
}
google = {
source = "hashicorp/google"
Expand All @@ -91,7 +91,7 @@ You will need to declare the [providers](https://registry.terraform.io/browse/pr
source = "hashicorp/random"
}
}
required_version = ">= 0.13"
required_version = ">= 1.2"
}

# Providers
Expand Down Expand Up @@ -126,7 +126,7 @@ The following configuration will modify settings in your Cloudflare account.
}

# Creates a new locally-managed tunnel for the GCP VM.
resource "cloudflare_tunnel" "auto_tunnel" {
resource "cloudflare_zero_trust_tunnel_cloudflared" "auto_tunnel" {
account_id = var.cloudflare_account_id
name = "Terraform GCP tunnel"
secret = base64sha256(random_password.tunnel_secret.result)
Expand All @@ -136,14 +136,14 @@ The following configuration will modify settings in your Cloudflare account.
resource "cloudflare_record" "http_app" {
zone_id = var.cloudflare_zone_id
name = "http_app"
content = "${cloudflare_tunnel.auto_tunnel.cname}"
content = "${cloudflare_zero_trust_tunnel_cloudflared.auto_tunnel.cname}"
type = "CNAME"
proxied = true
}

# Creates the configuration for the tunnel.
resource "cloudflare_tunnel_config" "auto_tunnel" {
tunnel_id = cloudflare_tunnel.auto_tunnel.id
resource "cloudflare_zero_trust_tunnel_cloudflared_config" "auto_tunnel" {
tunnel_id = cloudflare_zero_trust_tunnel_cloudflared.auto_tunnel.id
account_id = var.cloudflare_account_id
config {
ingress_rule {
Expand All @@ -154,7 +154,7 @@ The following configuration will modify settings in your Cloudflare account.
access {
required = true
team_name = "myteam"
aud_tag = [cloudflare_access_application.http_app.aud]
aud_tag = [cloudflare_zero_trust_access_application.http_app.aud]
}
}
}
Expand All @@ -165,16 +165,16 @@ The following configuration will modify settings in your Cloudflare account.
}

# Creates an Access application to control who can connect.
resource "cloudflare_access_application" "http_app" {
resource "cloudflare_zero_trust_access_application" "http_app" {
zone_id = var.cloudflare_zone_id
name = "Access application for http_app.${var.cloudflare_zone}"
domain = "http_app.${var.cloudflare_zone}"
session_duration = "1h"
}

# Creates an Access policy for the application.
resource "cloudflare_access_policy" "http_policy" {
application_id = cloudflare_access_application.http_app.id
resource "cloudflare_zero_trust_access_policy" "http_policy" {
application_id = cloudflare_zero_trust_access_application.http_app.id
zone_id = var.cloudflare_zone_id
name = "Example policy for http_app.${var.cloudflare_zone}"
precedence = "1"
Expand Down Expand Up @@ -232,7 +232,7 @@ The following configuration defines the specifications for the GCP virtual machi
// Configures the VM to run a startup script that takes in the Terraform variables.
metadata_startup_script = templatefile("./install-tunnel.tpl",
{
tunnel_token = cloudflare_tunnel.auto_tunnel.tunnel_token
tunnel_token = cloudflare_zero_trust_tunnel_cloudflared.auto_tunnel.tunnel_token
})
}
```
Expand Down
Loading