-
Notifications
You must be signed in to change notification settings - Fork 10k
[ZT] Terraform local domain fallback #22318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 0 additions & 9 deletions
9
src/content/partials/cloudflare-one/warp/add-local-domain-IP.mdx
This file was deleted.
Oops, something went wrong.
119 changes: 119 additions & 0 deletions
119
src/content/partials/cloudflare-one/warp/add-local-domain.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| --- | ||
| {} | ||
|
|
||
| --- | ||
|
|
||
| import { Render, Tabs, TabItem } from "~/components" | ||
|
|
||
| To add a domain to the Local Domain Fallback list: | ||
|
|
||
| <Tabs syncKey="dashPlusAPI"> <TabItem label="Dashboard"> | ||
|
|
||
| <Render file="warp/view-local-domains" product="cloudflare-one" /> | ||
|
|
||
| 4. In **Domain**, enter the apex domain (`example.com`) that you want to resolve using your private DNS server. All prefixes under the apex domain are subject to Local Domain Fallback (in other words, `example.com` is interpreted as `*.example.com`). | ||
|
|
||
| 5. In **DNS Servers**, enter the IP address of the DNS server that should resolve that domain name. | ||
|
|
||
| 6. Enter an optional description and select **Save domain**. | ||
|
|
||
| </TabItem> <TabItem label="Terraform (v5)"> | ||
|
|
||
| A Local Domain Fallback list is scoped to a specific [device profile](/cloudflare-one/connections/connect-devices/warp/configure-warp/device-profiles/). If a device profile does not have a corresponding Local Domain Fallback resource, those devices will use the default local domains shown in Step 2. | ||
|
|
||
| 1. Add the following permission to your [`cloudflare_api_token`](https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/api_token): | ||
| - `Zero Trust Write` | ||
|
|
||
| 2. (Optional) Create a list of domains that you can reuse across multiple device profiles. For example, you can declare a local value in the same module as your device profiles: | ||
|
|
||
| ```tf title="local-domains.local.tf" | ||
| locals { | ||
| default_local_domains = [ | ||
| # Default Local Domain Fallback entries recommended by Cloudflare | ||
| { | ||
| suffix = "corp" | ||
| }, | ||
| { | ||
| suffix = "domain" | ||
| }, | ||
| { | ||
| suffix = "home" | ||
| }, | ||
| { | ||
| suffix = "home.arpa" | ||
| }, | ||
| { | ||
| suffix = "host" | ||
| }, | ||
| { | ||
| suffix = "internal" | ||
| }, | ||
| { | ||
| suffix = "intranet" | ||
| }, | ||
| { | ||
| suffix = "invalid" | ||
| }, | ||
| { | ||
| suffix = "lan" | ||
| }, | ||
| { | ||
| suffix = "local" | ||
| }, | ||
| { | ||
| suffix = "localdomain" | ||
| }, | ||
| { | ||
| suffix = "localhost" | ||
| }, | ||
| { | ||
| suffix = "private" | ||
| }, | ||
| { | ||
| suffix = "test" | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
| 4. To configure Local Domain Fallback for the default device profile, use the [`cloudflare_zero_trust_device_default_profile_local_domain_fallback`](https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/zero_trust_device_default_profile_local_domain_fallback) resource. To configure Local Domain Fallback for a custom device profile, use[`cloudflare_zero_trust_device_custom_profile_local_domain_fallback`](https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/zero_trust_device_custom_profile_local_domain_fallback). For example: | ||
|
|
||
| ```tf title="device-profiles.tf" | ||
| resource "cloudflare_zero_trust_device_custom_profile_local_domain_fallback" "example" { | ||
| account_id = var.cloudflare_account_id | ||
| policy_id = cloudflare_zero_trust_device_custom_profile.example.id | ||
| domains = concat( | ||
| # Global entries | ||
| local.default_local_domains, | ||
|
|
||
| # Profile-specific entries | ||
| [ | ||
| { | ||
| suffix = "example.com" | ||
| description = "Domain for local development" | ||
| dns_server = ["1.1.1.1", "192.168.0.1"] | ||
| } | ||
| ] | ||
| ) | ||
| } | ||
| ``` | ||
|
|
||
| For `suffix`, specify the apex domain (`example.com`) that you want to resolve using your private DNS server. All prefixes under the apex domain are subject to Local Domain Fallback (in other words, `example.com` is interpreted as `*.example.com`). For `dns_server`, enter the IP address of the DNS server that should resolve that domain name. | ||
ranbel marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| </TabItem> | ||
| </Tabs> | ||
|
|
||
| WARP tries all servers and always uses the fastest response, even if that response is `no records found`. We recommend specifying at least one DNS server for each domain. If a value is not specified, the WARP client will try to identify the DNS server (or servers) used on the device before it started, and use that server for each domain in the Local Domain Fallback list. | ||
|
|
||
| ### Route traffic to fallback server | ||
|
|
||
| The WARP client routes DNS traffic to your [Local Domain Fallback server](#add-a-domain) according to your [Split Tunnel configuration](/cloudflare-one/connections/connect-devices/warp/configure-warp/route-traffic/split-tunnels/). To ensure that queries can reach your private DNS server: | ||
|
|
||
| - If your DNS server is only reachable inside of the WARP tunnel (for example, via `cloudflared` or Magic WAN): | ||
|
|
||
| 1. Go to **Networks** > **Routes** and verify that the DNS server is connected to Cloudflare. To connect a DNS server, refer to [Private networks](/cloudflare-one/connections/connect-networks/private-net/). | ||
|
|
||
| 2. In your [Split Tunnel configuration](/cloudflare-one/connections/connect-devices/warp/configure-warp/route-traffic/split-tunnels/), verify that the DNS server IP routes through the WARP tunnel. | ||
|
|
||
| - If your DNS server is only reachable outside of the WARP tunnel (for example, via a third-party VPN), verify that the DNS server IP is [excluded from the WARP tunnel](/cloudflare-one/connections/connect-devices/warp/configure-warp/route-traffic/split-tunnels/). | ||
|
|
||
| For more information, refer to [How the WARP client handles DNS requests](/cloudflare-one/connections/connect-devices/warp/configure-warp/route-traffic/#how-the-warp-client-handles-dns-requests). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.