Skip to content

Commit 18a0c3d

Browse files
committed
move tunnel token steps to partial
1 parent e0b1e59 commit 18a0c3d

File tree

3 files changed

+59
-45
lines changed

3 files changed

+59
-45
lines changed

Diff for: src/content/docs/cloudflare-one/connections/connect-networks/configure-tunnels/remote-tunnel-permissions.mdx

+7
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ Make a `GET` request to the [Cloudflare Tunnel token](/api/resources/zero_trust/
3535
```
3636

3737
</TabItem>
38+
39+
<TabItem label="Terraform (v5)">
40+
41+
<Render file="terraform/get-tunnel-token" product="cloudflare-one" />
42+
43+
</TabItem>
44+
3845
</Tabs>
3946

4047
## Rotate a token without service disruption

Diff for: src/content/docs/learning-paths/replace-vpn/connect-private-network/cloudflared.mdx

+2-45
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar:
66

77
---
88

9-
import { Render, Tabs, TabItem, Details } from "~/components"
9+
import { Render, Tabs, TabItem } from "~/components"
1010

1111
Cloudflare Tunnel is an outbound-only daemon service that can run on nearly any host machine and proxies local traffic once validated from the Cloudflare network. User traffic initiated from the WARP endpoint client onramps to Cloudflare, passes down your Cloudflare Tunnel connections, and terminates automatically in your local network. Traffic reaching your internal applications or services will carry the local source IP address of the host machine running the `cloudflared` daemon.
1212

@@ -61,50 +61,7 @@ To connect your private network:
6161
```
6262

6363
5. Get the [token](/cloudflare-one/connections/connect-networks/configure-tunnels/remote-tunnel-permissions/) used to run the tunnel:
64-
65-
```tf
66-
data "cloudflare_zero_trust_tunnel_cloudflared_token" "tunnel_token" {
67-
account_id = var.cloudflare_account_id
68-
tunnel_id = cloudflare_zero_trust_tunnel_cloudflared.example_tunnel.id
69-
}
70-
```
71-
72-
If your host machine is not managed in Terraform or you want to install the tunnel manually, you can output the token value to the CLI.
73-
<Details header="Example: Output to CLI" open = {false}>
74-
1. Output the tunnel token to the Terraform state file:
75-
```tf
76-
output "tunnel_token" {
77-
value = data.cloudflare_zero_trust_tunnel_cloudflared_token.tunnel_token.token
78-
sensitive = true
79-
}
80-
```
81-
2. Apply the configuration:
82-
```sh
83-
terraform apply
84-
```
85-
3. Read the tunnel token:
86-
```sh
87-
terraform output -raw tunnel_token
88-
```
89-
```sh output
90-
eyJhIj...
91-
```
92-
93-
</Details>
94-
95-
Alternatively, pass `data.cloudflare_zero_trust_tunnel_cloudflared_token.tunnel_token.token` directly into your host's Terraform configuration or store the token in your secret management tool.
96-
97-
<Details header="Example: Store in HashiCorp Vault" open = {false}>
98-
```tf
99-
resource "vault_generic_secret" "tunnel_token" {
100-
path = "kv/cloudflare/tunnel_token"
101-
102-
data_json = jsonencode({
103-
"TUNNEL_TOKEN" = data.cloudflare_zero_trust_tunnel_cloudflared_token.tunnel_token.token
104-
})
105-
}
106-
```
107-
</Details>
64+
<Render file="terraform/get-tunnel-token" product="cloudflare-one" />
10865

10966
6. Install `cloudflared` on a host machine in your private network and run the tunnel:
11067

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
{}
3+
4+
---
5+
6+
import { Details } from "~/components"
7+
8+
```tf
9+
data "cloudflare_zero_trust_tunnel_cloudflared_token" "tunnel_token" {
10+
account_id = var.cloudflare_account_id
11+
tunnel_id = cloudflare_zero_trust_tunnel_cloudflared.example_tunnel.id
12+
}
13+
```
14+
15+
If your host machine is not managed in Terraform or you want to install the tunnel manually, you can output the token value to the CLI.
16+
<Details header="Example: Output to CLI" open = {false}>
17+
1. Output the tunnel token to the Terraform state file:
18+
```tf
19+
output "tunnel_token" {
20+
value = data.cloudflare_zero_trust_tunnel_cloudflared_token.tunnel_token.token
21+
sensitive = true
22+
}
23+
```
24+
2. Apply the configuration:
25+
```sh
26+
terraform apply
27+
```
28+
3. Read the tunnel token:
29+
```sh
30+
terraform output -raw tunnel_token
31+
```
32+
```sh output
33+
eyJhIj...
34+
```
35+
36+
</Details>
37+
38+
Alternatively, pass `data.cloudflare_zero_trust_tunnel_cloudflared_token.tunnel_token.token` directly into your host's Terraform configuration or store the token in your secret management tool.
39+
40+
<Details header="Example: Store in HashiCorp Vault" open = {false}>
41+
```tf
42+
resource "vault_generic_secret" "tunnel_token" {
43+
path = "kv/cloudflare/tunnel_token"
44+
45+
data_json = jsonencode({
46+
"TUNNEL_TOKEN" = data.cloudflare_zero_trust_tunnel_cloudflared_token.tunnel_token.token
47+
})
48+
}
49+
```
50+
</Details>

0 commit comments

Comments
 (0)