|
3 | 3 |
|
4 | 4 | --- |
5 | 5 |
|
6 | | -import { Tabs, TabItem } from '~/components'; |
| 6 | +import { Tabs, TabItem, Details } from '~/components'; |
7 | 7 |
|
8 | 8 | <Tabs syncKey="dashPlusAPI"> <TabItem label="Dashboard"> |
9 | 9 |
|
@@ -32,35 +32,56 @@ import { Tabs, TabItem } from '~/components'; |
32 | 32 |
|
33 | 33 | ```tf |
34 | 34 | resource "cloudflare_zero_trust_access_service_token" "example_service_token" { |
35 | | - account_id = var.cloudflare_account_id |
36 | | - name = "Example service token" |
37 | | - duration = "8760h" |
38 | | - } |
39 | | - ``` |
| 35 | + account_id = var.cloudflare_account_id |
| 36 | + name = "Example service token" |
| 37 | + duration = "8760h" |
40 | 38 |
|
41 | | -3. Output the Client ID and Client Secret to the Terraform state file: |
42 | | - |
43 | | - ```tf |
44 | | - output "example_service_token_client_id" { |
45 | | - value = cloudflare_zero_trust_access_service_token.example_service_token.client_id |
| 39 | + lifecycle { |
| 40 | + create_before_destroy = true |
| 41 | + } |
46 | 42 | } |
| 43 | + ``` |
47 | 44 |
|
48 | | - output "example_service_token_client_secret" { |
49 | | - value = cloudflare_zero_trust_access_service_token.example_service_token.client_secret |
50 | | - sensitive = true |
| 45 | +3. To output the Client ID and Client Secret of the service token: |
| 46 | + |
| 47 | + <Details header="Example: Output to CLI" open = {false}> |
| 48 | + 1. Output the Client ID and Client Secret to the Terraform state file: |
| 49 | + ```tf |
| 50 | + output "example_service_token_client_id" { |
| 51 | + value = cloudflare_zero_trust_access_service_token.example_service_token.client_id |
| 52 | + } |
| 53 | +
|
| 54 | + output "example_service_token_client_secret" { |
| 55 | + value = cloudflare_zero_trust_access_service_token.example_service_token.client_secret |
| 56 | + sensitive = true |
| 57 | + } |
| 58 | + ``` |
| 59 | + 2. Apply the configuration: |
| 60 | + ```sh |
| 61 | + terraform apply |
| 62 | + ``` |
| 63 | + 3. Read the Client ID and Client Secret: |
| 64 | + ```sh |
| 65 | + terraform output -raw example_service_token_client_id |
| 66 | + ``` |
| 67 | + ```sh |
| 68 | + terraform output -raw example_service_token_client_secret |
| 69 | + ``` |
| 70 | + </Details> |
| 71 | + |
| 72 | + <Details header="Example: Store in Hashicorp Vault" open = {false}> |
| 73 | + ```tf |
| 74 | + resource "vault_generic_secret" "example_service_token" { |
| 75 | + path = "kv/cloudflare/example_service_token" |
| 76 | + disable_read = true |
| 77 | +
|
| 78 | + data_json = jsonencode({ |
| 79 | + "CLIENT_ID" = cloudflare_access_service_token.example_service_token.client_id |
| 80 | + "CLIENT_SECRET" = cloudflare_access_service_token.example_service_token.client_secret |
| 81 | + }) |
51 | 82 | } |
52 | 83 | ``` |
53 | | -4. Apply the configuration: |
54 | | - ```sh |
55 | | - terraform apply |
56 | | - ``` |
| 84 | + </Details> |
57 | 85 |
|
58 | | -5. Read the Client ID and Client Secret: |
59 | | - ```sh |
60 | | - terraform output -raw example_service_token_client_id |
61 | | - ``` |
62 | | - ```sh |
63 | | - terraform output -raw example_service_token_client_secret |
64 | | - ``` |
65 | 86 |
|
66 | 87 | </TabItem> </Tabs> |
0 commit comments