You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/cloudflare-one/connections/connect-networks/get-started/create-remote-tunnel-api.mdx
+1-43Lines changed: 1 addition & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -142,49 +142,7 @@ To configure Zero Trust policies and connect as a user, refer to [Connect privat
142
142
143
143
Install `cloudflared` on your server and run the tunnel using the `token` value obtained in [2. Create a tunnel](#2-create-a-tunnel). You can also get the tunnel token using the [Cloudflare Tunnel token](/api/resources/zero_trust/subresources/tunnels/subresources/cloudflared/subresources/token/methods/get/) endpoint.
144
144
145
-
<Tabs> <TabItemlabel="Linux">
146
-
147
-
1.[Download and install](https://pkg.cloudflare.com/index.html)`cloudflared`.
148
-
149
-
2. Run the following command:
150
-
151
-
```sh
152
-
sudo cloudflared service install <tunnel-token>
153
-
```
154
-
155
-
</TabItem> <TabItemlabel="Windows">
156
-
157
-
1.[Download and install](/cloudflare-one/connections/connect-networks/downloads/#windows)`cloudflared`.
158
-
159
-
2. Open Command Prompt as administrator.
160
-
161
-
3. Run the following command:
162
-
163
-
```txt
164
-
cloudflared.exe service install <tunnel-token>
165
-
```
166
-
167
-
</TabItem> <TabItemlabel="macOS">
168
-
169
-
1.[Download and install](/cloudflare-one/connections/connect-networks/downloads/#macos)`cloudflared`.
170
-
171
-
2. Run the following command:
172
-
173
-
```sh
174
-
sudo cloudflared service install <tunnel-token>
175
-
```
176
-
177
-
</TabItem> <TabItemlabel="Docker">
178
-
179
-
1. Open a terminal window.
180
-
181
-
2. Run the following command:
182
-
183
-
```sh
184
-
docker run cloudflare/cloudflared:latest tunnel --no-autoupdate run --token <tunnel-token>
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.
9. In the **Private Networks** tab, enter the CIDR of your private network (for example, `10.0.0.0/8`).
20
24
21
25
10. Select **Save tunnel**.
22
26
27
+
</TabItem>
28
+
<TabItemlabel="Terraform (v5)">
29
+
30
+
1. Add the following permission to your [`cloudflare_api_token`](https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/api_token):
31
+
-`Cloudflare Tunnel Write`
32
+
33
+
2. Generate a secret for the tunnel using Terraform's [`random` provider](https://registry.terraform.io/providers/hashicorp/random/latest/docs):
34
+
35
+
```tf
36
+
resource "random_bytes" "tunnel_secret" {
37
+
length = 64
38
+
}
39
+
```
40
+
41
+
3. Create a tunnel using the [`cloudflare_zero_trust_tunnel_cloudflare`](https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/zero_trust_tunnel_cloudflared) resource.
4. Route the CIDR of your private network through the tunnel using the [`cloudflare_zero_trust_tunnel_cloudflared_route`](https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/zero_trust_tunnel_cloudflared_route) resource:
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
+
<Detailsheader="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
+
<Detailsheader="Example: Store in HashiCorp Vault"open={false}>
0 commit comments