Back to Infisical

Datadog API Key

docs/documentation/platform/secret-rotation/datadog-api-key.mdx

0.162.116.3 KB
Original Source
<Note> **Rotation Type: Dual-Phase**

This rotation maintains two active credential sets with overlapping validity, ensuring zero-downtime during rotation cycles. </Note>

Prerequisites

  • Create a Datadog Connection using the API Key method (both an API Key and an Application Key are required).
  • The Application Key used by the connection must belong to a user with permission to create and delete API keys. Set api_keys_read and api_keys_write under API and Application Keys in the key's scopes.

Create a Datadog API Key Rotation in Infisical

<Tabs> <Tab title="Infisical UI"> 1. Navigate to your Secret Manager Project's Dashboard and select **Add Secret Rotation** from the actions dropdown.
    ![Secret Manager Dashboard](/images/secret-rotations-v2/generic/add-secret-rotation.png)

    2. Select the **Datadog API Key** option.

    ![Select Datadog API Key](/images/secret-rotations-v2/datadog-api-key/datadog-api-key-option.png)

    3. Configure the rotation behavior, then click **Next**.

    ![Rotation Configuration](/images/secret-rotations-v2/datadog-api-key/datadog-configuration.png)

    - **Datadog Connection** - the connection that will perform the rotation of the API Key.
    - **Rotation Interval** - the interval, in days, that once elapsed will trigger a rotation.
    - **Rotate At** - the local time of day when rotation should occur once the interval has elapsed.
    - **Auto-Rotation Enabled** - whether secrets should automatically be rotated once the rotation interval has elapsed. Disable this option to manually rotate secrets or pause secret rotation.

    4. Provide a **Key Name** for the generated Datadog API keys. Then click **Next**.

    ![Rotation Parameters](/images/secret-rotations-v2/datadog-api-key/datadog-parameter.png)

    - **Key Name** - the name assigned to the API keys created by this rotation in Datadog. Each rotation creates a new key using this name.

    5. Specify the secret names that the rotated credentials should be mapped to. Then click **Next**.

    ![Rotation Secrets Mapping](/images/secret-rotations-v2/datadog-api-key/datadog-mappings.png)

    - **API Key ID** - the name of the secret that the Datadog API Key ID will be mapped to.
    - **API Key** - the name of the secret that the rotated Datadog API Key value will be mapped to.

    6. Give your rotation a name and description (optional). Then click **Next**.

    ![Rotation Details](/images/secret-rotations-v2/datadog/datadog-details.png)

    - **Name** - the name of the secret rotation configuration. Must be slug-friendly.
    - **Description** (optional) - a description of this rotation configuration.

    7. Review your configuration, then click **Create Secret Rotation**.

    ![Rotation Review](/images/secret-rotations-v2/datadog-api-key/datadog-review.png)

    8. Your **Datadog API Key** credentials are now available for use via the mapped secrets.

    ![Datadog Credentials](/images/secret-rotations-v2/datadog-api-key/datadog-credentials.png)
</Tab>
<Tab title="API">
    To create a Datadog API Key Rotation, make an API request to the [Create Datadog API Key Rotation](/api-reference/endpoints/secret-rotations/datadog-api-key/create) API endpoint.

    ### Sample request

    ```bash Request
    curl --request POST \
    --url https://us.infisical.com/api/v2/secret-rotations/datadog-api-key \
    --header 'Content-Type: application/json' \
    --data '{
        "name": "my-datadog-rotation",
        "projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "description": "my datadog api key rotation",
        "connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "environment": "dev",
        "secretPath": "/",
        "isAutoRotationEnabled": true,
        "rotationInterval": 30,
        "rotateAtUtc": {
            "hours": 0,
            "minutes": 0
        },
        "parameters": {
            "name": "Infisical Rotated API Key"
        },
        "secretsMapping": {
            "apiKeyId": "DATADOG_API_KEY_ID",
            "apiKey": "DATADOG_API_KEY"
        }
    }'
    ```

    ### Sample response

    ```bash Response
    {
        "secretRotation": {
            "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "name": "my-datadog-rotation",
            "description": "my datadog api key rotation",
            "secretsMapping": {
                "apiKeyId": "DATADOG_API_KEY_ID",
                "apiKey": "DATADOG_API_KEY"
            },
            "isAutoRotationEnabled": true,
            "activeIndex": 0,
            "folderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "createdAt": "2023-11-07T05:31:56Z",
            "updatedAt": "2023-11-07T05:31:56Z",
            "rotationInterval": 30,
            "rotationStatus": "success",
            "lastRotationAttemptedAt": "2023-11-07T05:31:56Z",
            "lastRotatedAt": "2023-11-07T05:31:56Z",
            "lastRotationJobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "nextRotationAt": "2023-11-07T05:31:56Z",
            "connection": {
                "app": "datadog",
                "name": "my-datadog-connection",
                "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
            },
            "environment": {
                "slug": "dev",
                "name": "Development",
                "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
            },
            "projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "folder": {
                "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                "path": "/"
            },
            "rotateAtUtc": {
                "hours": 0,
                "minutes": 0
            },
            "lastRotationMessage": null,
            "type": "datadog-api-key",
            "parameters": {
                "name": "Infisical Rotated API Key"
            }
        }
    }
    ```
</Tab>
</Tabs>