diff --git a/src/content/partials/cloudflare-one/access/create-service-token.mdx b/src/content/partials/cloudflare-one/access/create-service-token.mdx index 3934f7e169045b..9f38fcddd00aa3 100644 --- a/src/content/partials/cloudflare-one/access/create-service-token.mdx +++ b/src/content/partials/cloudflare-one/access/create-service-token.mdx @@ -3,7 +3,7 @@ --- -import { Tabs, TabItem } from '~/components'; +import { Tabs, TabItem, Details } from '~/components'; @@ -32,35 +32,56 @@ import { Tabs, TabItem } from '~/components'; ```tf resource "cloudflare_zero_trust_access_service_token" "example_service_token" { - account_id = var.cloudflare_account_id - name = "Example service token" - duration = "8760h" - } - ``` + account_id = var.cloudflare_account_id + name = "Example service token" + duration = "8760h" -3. Output the Client ID and Client Secret to the Terraform state file: - - ```tf - output "example_service_token_client_id" { - value = cloudflare_zero_trust_access_service_token.example_service_token.client_id + lifecycle { + create_before_destroy = true + } } + ``` - output "example_service_token_client_secret" { - value = cloudflare_zero_trust_access_service_token.example_service_token.client_secret - sensitive = true +3. Get the Client ID and Client Secret of the service token: + +
+ 1. Output the Client ID and Client Secret to the Terraform state file: + ```tf + output "example_service_token_client_id" { + value = cloudflare_zero_trust_access_service_token.example_service_token.client_id + } + + output "example_service_token_client_secret" { + value = cloudflare_zero_trust_access_service_token.example_service_token.client_secret + sensitive = true + } + ``` + 2. Apply the configuration: + ```sh + terraform apply + ``` + 3. Read the Client ID and Client Secret: + ```sh + terraform output -raw example_service_token_client_id + ``` + ```sh + terraform output -raw example_service_token_client_secret + ``` +
+ +
+ ```tf + resource "vault_generic_secret" "example_service_token" { + path = "kv/cloudflare/example_service_token" + disable_read = true + + data_json = jsonencode({ + "CLIENT_ID" = cloudflare_access_service_token.example_service_token.client_id + "CLIENT_SECRET" = cloudflare_access_service_token.example_service_token.client_secret + }) } ``` -4. Apply the configuration: - ```sh - terraform apply - ``` +
-5. Read the Client ID and Client Secret: - ```sh - terraform output -raw example_service_token_client_id - ``` - ```sh - terraform output -raw example_service_token_client_secret - ```