---
title: Export Synthetic Tests to Terraform
description: Generate Terraform configurations from your existing Synthetic tests.
breadcrumbs: >-
  Docs > Synthetic Testing and Monitoring > Synthetic Monitoring Guides > Export
  Synthetic Tests to Terraform
---

# Export Synthetic Tests to Terraform
Available for:
{% icon name="icon-synthetics" /%}
 API Tests | 
{% icon name="icon-synthetics" /%}
 Multistep API Tests | 
{% icon name="icon-browser" /%}
 Browser Tests 
## Overview{% #overview %}

You can export existing Synthetic tests to Terraform directly from the Datadog UI. The export generates a ready-to-use `datadog_synthetics_test` resource block in HCL format and copies it to your clipboard. Paste it into your Terraform files to start managing your tests as code.

Export to Terraform is supported for the following test types:

- API tests: HTTP, SSL, DNS, TCP, UDP, ICMP, WebSocket, and gRPC
- Multistep API tests, including per-step configuration
- Browser tests, with per-step export available in the recorder

## Export from the test details page{% #export-from-the-test-details-page %}

To export an API or Browser Test from the test details page:

1. Open any API test in Synthetic Monitoring.
1. Click **More** in the upper right corner of the page.
1. Select **Copy Terraform Snippet**.

{% image
   source="https://docs.dd-static.net/images/synthetics/guide/export-tests-to-terraform/copy_terraform.8b5d52bf58e14aa75b8de09d700e80d1.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/synthetics/guide/export-tests-to-terraform/copy_terraform.8b5d52bf58e14aa75b8de09d700e80d1.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="The More dropdown menu on the test details page with Copy Terraform Snippet highlighted" /%}

The generated HCL configuration is copied to your clipboard. Paste it into your `.tf` file as a `datadog_synthetics_test` resource.

## Export from the multistep API test recorder{% #export-from-the-multistep-api-test-recorder %}

To export a multistep API test while building or editing it:

1. Open or create a Multistep API test.
1. In the recorder view, click **Export to Terraform**.

{% image
   source="https://docs.dd-static.net/images/synthetics/guide/export-tests-to-terraform/multistep_export_to_terraform.320695b67d673fc415ce7c40a663636c.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/synthetics/guide/export-tests-to-terraform/multistep_export_to_terraform.320695b67d673fc415ce7c40a663636c.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="The Export to Terraform button in the multistep API test recorder" /%}

The generated Terraform configuration is copied to your clipboard. Paste it into your `.tf` file as a `datadog_synthetics_test` resource.

## Export a step from the browser test recorder{% #export-a-step-from-the-browser-test-recorder %}

You can export individual steps to Terraform while recording or editing a browser test. Each step exports a configuration snippet you can use as part of a `datadog_synthetics_test` resource.

To export a step:

1. Open or create a browser test and start recording.
1. Hover over a step in the recorder.
1. Click the **Copy Terraform step to clipboard** icon.

{% image
   source="https://docs.dd-static.net/images/synthetics/guide/export-tests-to-terraform/browser_test_recording_terraform_2.60e8305eef973aea3bbecf11f4f4b457.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/synthetics/guide/export-tests-to-terraform/browser_test_recording_terraform_2.60e8305eef973aea3bbecf11f4f4b457.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="The Copy Terraform step to clipboard icon in the browser test recorder" /%}

Paste the copied configuration into your `.tf` file as part of a `datadog_synthetics_test` resource.

## Further Reading{% #further-reading %}

- [Learn about API Tests](https://docs.datadoghq.com/synthetics/api_tests.md)
- [Learn about Multistep API Tests](https://docs.datadoghq.com/synthetics/multistep.md)
- [Learn about Browser Tests](https://docs.datadoghq.com/synthetics/browser_tests.md)
- [Manage Synthetic Tests with Terraform](https://registry.terraform.io/providers/DataDog/datadog/latest/docs/resources/synthetics_test)
