Skip to content

Commit 346bf32

Browse files
authored
[ZT] Import ZT org into Terraform (#19985)
* Import ZT org into Terraform * add min version * specify TF version * Update create-zero-trust-org.mdx
1 parent ddbe469 commit 346bf32

File tree

7 files changed

+82
-10
lines changed

7 files changed

+82
-10
lines changed

src/content/partials/cloudflare-one/access/add-infrastructure-app.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,13 @@ import { Tabs, TabItem, Render } from "~/components"
8383
```
8484

8585
</TabItem>
86-
<TabItem label="Terraform">
86+
<TabItem label="Terraform (v4)">
8787

88-
1. Add the following permission to your [`cloudflare_api_token`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.40.0/docs/resources/api_token):
88+
:::note[Provider versions]
89+
The following example requires Cloudflare provider version `>=4.45.0`.
90+
:::
91+
92+
1. Add the following permission to your [`cloudflare_api_token`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.45.0/docs/resources/api_token):
8993
- `Access: Apps and Policies Write`
9094

9195
2. Use the [`cloudflare_zero_trust_access_application`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.45.0/docs/resources/zero_trust_access_application) resource to create an infrastructure application:

src/content/partials/cloudflare-one/access/add-target.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,13 @@ If the target IP does not appear in the dropdown, go to **Networks** > **Routes*
5555
```
5656

5757
</TabItem>
58-
<TabItem label="Terraform">
58+
<TabItem label="Terraform (v4)">
5959

60-
1. Add the following permission to your [`cloudflare_api_token`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.40.0/docs/resources/api_token):
60+
:::note[Provider versions]
61+
The following example requires Cloudflare provider version `>=4.45.0`.
62+
:::
63+
64+
1. Add the following permission to your [`cloudflare_api_token`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.45.0/docs/resources/api_token):
6165
- `Teams Write`
6266

6367
2. Configure the [`cloudflare_zero_trust_infrastructure_access_target`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.45.0/docs/resources/zero_trust_infrastructure_access_target) resource:

src/content/partials/cloudflare-one/access/create-service-token.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ import { Tabs, TabItem, Details } from '~/components';
2323
This is the only time Cloudflare Access will display the Client Secret. If you lose the Client Secret, you must generate a new service token.
2424
:::
2525

26-
</TabItem> <TabItem label="Terraform">
26+
</TabItem> <TabItem label="Terraform (v4)">
27+
28+
:::note[Provider versions]
29+
The following example requires Cloudflare provider version `>=4.40.0`.
30+
:::
2731

2832
1. Add the following permission to your [`cloudflare_api_token`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.40.0/docs/resources/api_token):
2933
- `Access: Service Tokens Write`

src/content/partials/cloudflare-one/warp/device-enrollment-mtls.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ To check for an mTLS certificate:
2121

2222
4. On your device, add the client certificate to the [system keychain](/cloudflare-one/identity/devices/access-integrations/mutual-tls-authentication/#test-in-the-browser).
2323

24-
</TabItem> <TabItem label="Terraform">
24+
</TabItem> <TabItem label="Terraform (v4)">
25+
26+
:::note[Provider versions]
27+
The following example requires Cloudflare provider version `>=4.40.0`.
28+
:::
2529

2630
1. Add the following permissions to your [`cloudflare_api_token`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.40.0/docs/resources/api_token):
2731
- `Access: Mutual TLS Certificates Write`

src/content/partials/cloudflare-one/warp/device-enrollment.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ Device posture checks are not supported in device enrollment policies. WARP can
2222
4. In the **Authentication** tab, select the [identity providers](/cloudflare-one/identity/idp-integration/) users can authenticate with. If you have not integrated an identity provider, you can use the [one-time PIN](/cloudflare-one/identity/one-time-pin/).
2323
5. Select **Save**.
2424

25-
</TabItem> <TabItem label="Terraform">
25+
</TabItem> <TabItem label="Terraform (v4)">
26+
27+
:::note[Provider versions]
28+
The following example requires Cloudflare provider version `>=4.40.0`.
29+
:::
2630

2731
1. Add the following permission to your [`cloudflare_api_token`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.40.0/docs/resources/api_token):
2832
- `Access: Apps and Policies Write`

src/content/partials/cloudflare-one/warp/service-token-enrollment.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ import { Tabs, TabItem } from '~/components';
2121
* `auth_client_id`: The **Client ID** of your service token.
2222
* `auth_client_secret`: The **Client Secret** of your service token.
2323

24-
</TabItem> <TabItem label="Terraform">
24+
</TabItem> <TabItem label="Terraform (v4)">
25+
26+
:::note[Provider versions]
27+
The following example requires Cloudflare provider version `>=4.40.0`.
28+
:::
2529

2630
1. Add the following permission to your [`cloudflare_api_token`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.40.0/docs/resources/api_token):
2731
- `Access: Apps and Policies Write`

src/content/partials/learning-paths/zero-trust/create-zero-trust-org.mdx

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,56 @@
33

44
---
55

6-
import { Render } from "~/components"
6+
import { Render, Tabs, TabItem} from "~/components"
77

8-
To set up a Zero Trust organization:
8+
To start using Zero Trust features, create a Zero Trust organization in your Cloudflare account.
9+
10+
## Sign up for Zero Trust
11+
12+
To create a Zero Trust organization:
913

1014
<Render file="choose-team-name" product="cloudflare-one" />
15+
16+
## (Optional) Manage Zero Trust in Terraform
17+
18+
You can use the [Cloudflare Terraform provider](https://registry.terraform.io/providers/cloudflare/cloudflare/latest) to manage your Zero Trust organization alongside your other IT infrastructure. To get started with Terraform, refer to our [Terraform tutorial series](/terraform/tutorial/).
19+
20+
Zero Trust organizations cannot be created through Terraform. You must [sign up for Zero Trust](#sign-up-for-zero-trust) on the Cloudflare dashboard and then import the resource into your [Terraform configuration](/terraform/).
21+
22+
To import your Zero Trust organization:
23+
24+
<Tabs> <TabItem label="Terraform (v4)">
25+
26+
:::note[Provider versions]
27+
The following example requires Cloudflare provider version `>=4.40.0`.
28+
:::
29+
30+
1. Add the following permission to your [`cloudflare_api_token`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.40.0/docs/resources/api_token):
31+
- `Access: Organizations, Identity Providers, and Groups Write`
32+
33+
2. Add the [`cloudflare_zero_trust_access_organization`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.40.0/docs/resources/zero_trust_access_organization) resource:
34+
35+
```terraform
36+
resource "cloudflare_zero_trust_access_organization" "<your-team-name>" {
37+
account_id = var.cloudflare_account_id
38+
name = "Acme Corporation"
39+
auth_domain = "<your-team-name>.cloudflareaccess.com"
40+
}
41+
```
42+
Replace `<your-team-name` with the Zero Trust organization name selected during [onboarding](#sign-up-for-zero-trust). You can also view your team name on [Zero Trust](https://one.dash.cloudflare.com) under **Settings** > **Custom Pages**.
43+
44+
3. In a terminal, run:
45+
46+
```sh
47+
terraform import cloudflare_zero_trust_access_organization.<your-team-name> <cloudflare_account_id>`
48+
```
49+
50+
</TabItem>
51+
52+
</Tabs>
53+
54+
You can now update the Zero Trust organization using Terraform.
55+
56+
:::tip
57+
If you plan to manage all Zero Trust settings in Terraform, set the dashboard to [API/Terraform read-only mode](/cloudflare-one/api-terraform/#set-dashboard-to-read-only).
58+
:::

0 commit comments

Comments
 (0)