Introduction
Terraform is a popular Infrastructure-as-Code tool that can be used to quickly provision resources. With the Catchpoint Terraform provider, users can manage (Create, Read, Update, and Delete) Web, API, Transaction, DNS, SSL, BGP, Traceroute, and Ping tests with minimum configurations. To inherit sections such as Scheduling, Advanced Settings, Insights, and Alerts, simply omit the corresponding blocks.
Prerequisites
- Terraform
- Catchpoint account with a REST API V2 Token
Installation & Configuration
-
Download the appropriate binary attached to the bottom of this article per your operating system.
- Linux -
terraform-provider-catchpoint - MacOS with M1 or M2 processor -
terraform-provider-catchpoint_darwin_arm64 - MacOS with Intel Processor -
terraform-provider-catchpoint_darwin_amd64
- Linux -
-
Extract the files from the downloaded zip file:
terraform-provider-catchpoint(Terraform provider binary)main.tf(configuration file example for Object Test)
(The additional subfolders each contain another main.tf file configured to set up another test type.)
-
Place the binary and the desired
main.tffile atterraform.d/plugins/<SOURCE HOST>/<SOURCE NAMESPACE>/<PLUGIN NAME>/<VERSION>/linux_amd64, relative to the root of the directory.
Note: For MacOS the path name will change accordingly e.g.~/.terraform.d/plugins/terraform-catchpoint/catchpointprovider/catchpoint/1.0.0/darwin_amd64 -
Edit the
main.tffile and modify the source host and namespace in therequired_providersblock to match the location where you placed the binary.
For example, if theterraform-provider-catchpointbinary is placed in/.terraform.d/plugins/terraform-catchpoint/catchpointprovider/catchpoint/1.0.0/linux_amd64, then therequired_providersblock inmain.tfshould look like this:
terraform {
required_providers {
catchpoint = {
source = "catchpoint/catchpoint"
version = "1.1.0"
}
}
}
Pleas
3. In the main.tf file add your API v2 key to the provider block.
provider "catchpoint" {api_token="8D7E2B17C339AD3EDCDD0761D29AXXXXXXXXXXXXX"}
Note: if the API key is already exported to the environment variable CATCHPOINT_API_TOKEN, you may omit this block.
4. Edit the resource block to reflect the test you want to manage or create. The table in the following section lists supported test types and their properties.
Example:
resource "web_test" "test" {
provider=catchpoint
division_id=1000
product_id=15330
test_name="catchpointTf"
test_url="https://www.catchpoint.com"
enable_test_data_webhook=true
end_time="2023-09-05T04:59:00Z"
}
- The
main.tffile also includes sample blocks for the additional test settings sections. Any of these blocks you choose to keep will override inheritance for the corresponding settings in your test configuration. Any omitted blocks will be inherited from the parent Folder/Product.
Example:
resource "web_test" "test" {
provider=catchpoint
monitor="object"
division_id=1000
product_id=15330
test_name="catchpointTf"
test_url="https://www.catchpoint.com"
enable_test_data_webhook=true
end_time="2023-09-05T04:59:00Z"
request_settings {
http_request_headers {
user_agent {
value="terraform"
}
accept {
value="application/json"
child_host_pattern="www.google.com"
}
}
}
schedule_settings {
frequency="60 minutes"
node_distribution="concurrent" node_ids=[12,136]
}
alert_settings {
alert_rule {
alert_type="test failure"
node_threshold_type="runs"
threshold_number_of_runs=2
threshold_percentage_of_runs=60
}
notification_group {
recipient_email_ids=["recipient1@example.com"]
}
}
}
Supported Properties
This table lists the main properties supported for each Catchpoint test type, as well as the names of the optional settings blocks you may include. You can omit any unneeded blocks and those settings will be inherited from the parent Product/Folder. In general, the property names in the main.tf file should match the corresponding field labels in the Catchpoint Portal, but are all lower-case and use underscores (_) in place of spaces. (e.g. the Test Name property will be added to the main.tf file as "test_name")
| Resource Type | Configuration Settings |
|---|---|
| All (these settings apply to all resource types) |
|
| web_test |
Test Properties
|
| api_test |
Test Properties
|
| transaction_test |
Test Properties
|
| traceroute_test |
Test Properties
|
| ping_test |
Test Properties
|
| dns_test |
Test Properties
|
| bgp_test |
Test Properties
|
| ssl_test |
Test Properties
|
How To Run
- Create a directory with an arbitrary name.
- Navigate to the newly created directory.
- Create the
main.tffile with all the blocks mentioned above. Use any of the samplemain.tffiles from the attached .zip file for reference. - In the terminal, run
terraform initto initialize the provider. - Run
terraform planto see the changes to be applied. - Run
terraform applyto apply the plan. If Terraform Debug logs are enabled, the API response can be seen from the Catchpoint provider. The logs will indicate whether the test was created successfully.
Results

terraform-provider-catchpoint_darwin_arm64 (1) 2.zip