CI/CD pipelines for Terraform
If you are using or planning to use Terraform to manage your monitoring resources, chances are you will be using it in some sort of shared pipeline. This page aims to show how to get up and running with different CI/CD tools.
Handling remote state
Terraform relies on its stored state to know which resources it is supposed to manage and what to do to apply your configuration. If you are applying Terraform configurations from different machines, or are working on your setup with your colleagues, you need to make sure the Terraform state stays in sync. Failure to do that will lead to duplicated resources and other critical issues with your checks and other managed resources.
Terraform enables remote state management using backends. If you are new to Terraform and plan to use it with Checkly together with your team or the rest of your organization, make sure you set up a remote backend to enable frictionless collaboration.
Terraform Cloud
Terraform Cloud allows you to automate setting up your monitoring resources on Checkly, while also taking care of remote state management for you, with no configuration needed.
Getting started with Terraform Cloud is simple: you only need to create a new workspace and link it to version control.
Our linked repository will contain our Terraform code, for example:
variable "checkly_api_key" {}
variable "checkly_account_id" {}
terraform {
required_providers {
checkly = {
source = "checkly/checkly"
version = "~> 1.0"
}
}
}
provider "checkly" {
api_key = var.checkly_api_key
account_id = var.checkly_account_id
}
// Your resources here
While you can apply your Terraform configuration on-demand by clicking Actions
and Start new plan
, you will likely want to have your workspace set up to automatically apply it on every push to the default branch of the linked repository. You can enable that through the Auto apply
option under the General
settings panel of your Terraform Cloud workspace.
Any new push to the default branch of the repository will now result in your latest Terraform configuration being applied, which in turn means your Checkly monitoring setup will be updated.
Last updated on November 27, 2024. You can contribute to this documentation by editing this page on Github