Wavefront Terraform Provider
The Wavefront Terraform Provider recently became a Wavefront integration.
This integration currently supports a comprehensive set of Wavefront resources including alerts, alert targets and dashboards.
Wavefront Terraform Provider Setup
This setup is an reiteration of terraform-provider-wavefront.
Step 1. Download and Customize the Plugin
You can download the plugin from this git repository. Latest releases include darwin and linux amd64 packages. If you need a different architecture or OS, you can build the plugin from source. Go to terraform-provider-wavefront for details.
Once you have the plugin, remove the _os_arch from the end of the file name and place it in ~/.terraform.d/plugins which is where terraform init looks for plugins. See provider configuration for syntax details.
Step 2. Create a Terraform Config File
Create a main.tf with the following configurations.
provider "wavefront" {
address = "https://YOUR_CLUSTER.wavefront.com"
token = "YOUR_API_TOKEN"
}
resource "wavefront_alert" "test_alert" {
name = "Terraform Test Alert"
target = "test@example.com"
condition = "100 - ts(\"cpu.usage_idle\") > 80"
display_expression = "100-ts(\"cpu.usage_idle\")"
minutes = 5
resolve_after_minutes = 5
severity = "WARN"
tags = [
"terraform"
]
}
data "wavefront_alerts" "alerts" {
}
data "wavefront_alert" "alert" {
id = "sample-alert-id"
}
- In the
provider
block, provide your Wavefront address and the API token for your account.- You can also export the address (WAVEFRONT_ADDRESS) and token (WAVEFRONT_TOKEN) as environment variables to avoid committing them to source control (We highly recommend you to do this for the token!).
- In the resource block, each field corresponds to an alert object field. You use those alert object fields when creating alerts with the Wavefront API.
Step 3. Running the plugin
-
Verify that your Wavefront account has the Alerts permission.
Note: Before running
terraform init
, if you use terraform version 0.13 and later, runterraform 0.13upgrade
. -
Run
terraform init
to load your provider. -
Run
terraform plan
to show the plan. -
Run
terraform apply
to apply the test configuration and then check the results in Wavefront. -
Update main.tf to change a value, the run plan and apply again to check that updates work.
-
Run
terraform destroy
to test deleting resources.