Skip to content

Sematext Terraform Guide

You can now include Sematext Cloud as your go-to choice for fast deploy of visualization, APM, metrics and logging aspects within your cloud-as-code solutions using proven managed sub-components.

You can access the Sematext Cloud Provider in the Terraform Registry

Available Sematext Resources

Getting Started


You'll need the following :


Create the following environment variables:

export SEMATEXT_API_KEY="<your access key>"

Create a Terraform HCL script

In this simplistic case we create a file containing the following Terraform snippet.

terraform {
  required_providers {
    sematext = {
      source = "sematext/sematext"
      version = ">=0.1.3"

provider "sematext" {
    sematext_region = "US"

resource "sematext_monitor_mongodb" "monitor_mongodb" {
    name = "MongoDB Monitor Example"
    billing_plan_id = 125 

Save this to a file e.g.

We will use this to create a monitoring App in Sematext Cloud, ready to receive, in this case MongoDB Metrics. Note this will just demonstrate a starting point. Usually you would combine other Providers and deploy suitable agent-collectors.

Step 1 : Initialize a Deployment

Initialize Terraform state and download the Terraform Provider ready for use.

$ terraform init

Step 2 : Create a Deployment Plan

This will tell you the plan is to deploy a new sematext_monitor_mongodb on Sematext Cloud.

$ terraform plan

Step 3 : Execute the Deployment

Perform the deployment. Once done you now have a new monitoring App on Sematext Cloud, ready to receive, in this case MongoDB Metrics.

$ terraform apply

Step 4 : Modify the Plan

We want add an additional monitoring App on for Elasticsearch. Append the following snippet to the bottom of your

resource "sematext_monitor_elasticsearch" "monitor_elasticsearch" {
    name = "Elasticsearch Monitor Example"
    billing_plan_id = 12 

Step 5 : Re-Plan Deployment

This will tell you the plan is to deploy an additional new sematext_monitor_elasticsearch.

$ terraform plan

Step 6 : Execute Your Deployment

Perform the deployment. You will now have an additional Sematext Cloud Elasticsearch App ready to receive metrics.

$ terraform execute

Step 7 : Clean up

Once you are finished taking a look retire the two Apps you created.

$ terraform destroy

Note this sets the Apps to a retire status rather than deletion. They will be automatically removed after 30 days.

Refer to our examples repo for more realistic examples.

Recommendations for learning more about Sematext products and services:

  • Infrastructure integrations documentation
  • Our website
  • For open-source integrations and other Sematext contribution to the open-source community, check our GitHub repositories.
  • or just talk to us using chat located in right bottom corner of any page, and one of our engineers will help you navigate Sematext waters.