Skip to content

Commit b685b71

Browse files
authored
terraform examples (#22179)
1 parent 3ddd8f9 commit b685b71

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

src/content/docs/cloudflare-one/connections/connect-devices/warp/configure-warp/managed-networks.mdx

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ SHA256 Fingerprint=DD4F4806C57A5BBAF1AA5B080F0541DA75DB468D0A1FE731310149500CCD8
166166

167167
## 3. Add managed network to Zero Trust
168168

169+
<Tabs syncKey="dashPlusAPI"> <TabItem label="Dashboard">
170+
169171
1. In [Zero Trust](https://one.dash.cloudflare.com), go to **Settings** > **WARP Client**.
170172
2. Scroll down to **Network locations** and select **Add new**.
171173
3. Name your network location.
@@ -176,10 +178,34 @@ SHA256 Fingerprint=DD4F4806C57A5BBAF1AA5B080F0541DA75DB468D0A1FE731310149500CCD8
176178
:::
177179
5. (Optional) In **TLS Cert SHA-256**, enter the [SHA-256 fingerprint](#2-extract-the-sha-256-fingerprint) of the TLS certificate. This field is only needed for self-signed certificates. If a TLS fingerprint is not supplied, WARP validates the certificate against the local certificate store and checks that it is signed by a public certificate authority.
178180

181+
</TabItem>
182+
<TabItem label="Terraform (v5)">
183+
184+
1. Add the following permission to your [`cloudflare_api_token`](https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/api_token):
185+
- `Zero Trust Write`
186+
187+
2. Add a managed network using the [`cloudflare_zero_trust_device_managed_network`](https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/zero_trust_device_managed_network) resource:
188+
189+
```tf
190+
resource "cloudflare_zero_trust_device_managed_networks" "office" {
191+
account_id = var.cloudflare_account_id
192+
name = "Office managed network"
193+
type = "tls"
194+
config = {
195+
tls_sockaddr = "192.168.185.198:3333"
196+
sha256 = "DD4F4806C57A5BBAF1AA5B080F0541DA75DB468D0A1FE731310149500CCD8662"
197+
}
198+
}
199+
```
200+
</TabItem>
201+
</Tabs>
202+
179203
WARP will automatically exclude the TLS endpoint from all device profiles. This prevents remote users from accessing the endpoint through the WARP tunnel on any port. If a device profile uses [Split Tunnels](/cloudflare-one/connections/connect-devices/warp/configure-warp/route-traffic/split-tunnels/) in **Include** mode, make sure that the Split Tunnel entries do not contain the TLS endpoint IP address; otherwise, the entire IP range will be excluded from the WARP tunnel.
180204

181205
## 4. Configure device profile
182206

207+
<Tabs syncKey="dashPlusAPI"> <TabItem label="Dashboard">
208+
183209
1. In [Zero Trust](https://one.dash.cloudflare.com), go to **Settings** > **WARP Client**.
184210

185211
2. Under **Profile settings**, create a new [settings profile](/cloudflare-one/connections/connect-devices/warp/configure-warp/device-profiles/) or edit an existing profile.
@@ -192,6 +218,29 @@ WARP will automatically exclude the TLS endpoint from all device profiles. This
192218

193219
4. Save the profile.
194220

221+
</TabItem>
222+
<TabItem label="Terraform (v5)">
223+
224+
In [`cloudflare_zero_trust_device_custom_profile`](https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/zero_trust_device_custom_profile), configure a `match` expression using the `network` selector. For example, the following device profile will match all devices connected a specific managed network:
225+
226+
```tf
227+
resource "cloudflare_zero_trust_device_custom_profile" "office" {
228+
account_id = var.cloudflare_account_id
229+
name = "Office"
230+
description = "Devices connected to the office network"
231+
precedence = 1
232+
service_mode_v2 = {mode = "warp"}
233+
234+
match = trimspace(replace(<<-EOT
235+
network == "${cloudflare_zero_trust_device_managed_networks.office.name}"
236+
EOT
237+
, "\n", " "))
238+
}
239+
```
240+
241+
</TabItem>
242+
</Tabs>
243+
195244
Managed networks are now enabled. Every time a device in your organization connects to a network (for example, when waking up the device or changing Wi-Fi networks), the WARP client will determine its network location and apply the corresponding settings profile.
196245

197246
## 5. Verify managed network

0 commit comments

Comments
 (0)