Terraform provider

DataDome provides a Terraform provider to manage your DataDome workspace as code.

This provider is available on the Terraform registry.

Compatibility

  • Terraform >= 0.13.0

Prerequisites

📘

Management API Key

The Management API Key is not enabled by default.

Please contact your Technical Account Manager to enable it.

Supported features

FAQ

How to import existing resources with Terraform?

It is possible to import existing resources through the terraform import command.

You can follow this procedure to import these resources:

  1. Retrieve the management API key from the dashboard.
  2. Retrieve the list of a resource as described on the API Reference:
    1. For the custom rules
    2. For the endpoints
  3. At the location of the Terraform file, ensure that the Terraform working directory has been initialized: terraform init.
  4. Specify the apikey field in the provider as mentioned in our Terraform documentation.
  5. For each resource of the list:
    1. Add a line in the Terraform file with the following pattern: resource "RESOURCE_TYPE" "TERRAFORM_ENDPOINT_NAME" {}.
      Please note that you need to replace RESOURCE_TYPE by one of the supported resources and TERRAFORM_RESOURCE_NAME with the name of your choice.
    2. Run the import command to import the resource: terraform import RESOURCE_TYPE.TERRAFORM_RESOURCE_NAME ID_OF_THE_RESOURCE.
      Please note that you need to replace ID_OF_THE_RESOURCE with the correct ID of the resource.
    3. You should see the following output: Import successful!.
  6. Once all resources have been imported, run the terraform show command and replace your empty resources with the output of the command.
  7. Remove all occurrences of the id field from these resources.
  8. Verify that the infrastructure matches your configuration by running a terraform plan.
    You should see the following output: No changes. Your infrastructure matches the configuration.

You can now manage these existing resource with Terraform.