Cloud Authentication

Create an HCP Terraform persona mapping

Changed on

Create an HCP Terraform persona mapping. The mapping associates a Datadog user or service account with workload identity tokens from an HCP Terraform issuer whose sub claim matches sub_pattern.

The response includes the audience value to set as the TFC_WORKLOAD_IDENTITY_AUDIENCE_DATADOG environment variable in HCP Terraform. The API returns a 409 error if the pattern duplicates an existing mapping, or if it can match the same token as an existing mapping for a different account.

post/api/v2/wif/terraform/persona_mapping

Request

  • Base URL
    https://api.datadoghq.com
  • Auth
    • API key in header DD-API-KEY and API key in header DD-APPLICATION-KEY
    • or OAuth 2
      Authorization code/oauth2/v1/authorize
      Token URL/oauth2/v1/token
      Scopesworkload_identity_federation_write

Request body

Example request

{
  "data": {
    "attributes": {
      "account_identifier": "test@example.com",
      "issuer_url": "https://app.terraform.io",
      "sub_pattern": "organization:example-org:project:Default Project:workspace:example-workspace:run_phase:*"
    },
    "type": "terraform_cloud_auth_config"
  }
}

Response

Created

Example response

{
  "data": {
    "attributes": {
      "account_identifier": "test@example.com",
      "account_uuid": "12bbdc5c-5966-47e0-8733-285f9e44bcf4",
      "audience": "datadog/abcdef12-3456-7890-abcd-ef1234567890",
      "issuer_url": "https://app.terraform.io",
      "sub_pattern": "organization:example-org:project:Default Project:workspace:example-workspace:run_phase:*"
    },
    "id": "6f1c7a52-3d2e-4f8b-9a41-0c5d8e7b2f19",
    "type": "terraform_cloud_auth_config"
  }
}

Changes

    • warning

      the optional response header X-RateLimit-Limit removed for the status 429

    • warning

      the optional response header X-RateLimit-Period removed for the status 429

    • warning

      the optional response header X-RateLimit-Remaining removed for the status 429

    1 more change in this revision