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¶
- Akka
- AWS EC2
- AWS ELB
- AWS EBS
- Apache
- Cassandra
- ClickHouse
- Elasticsearch
- HAProxy
- HBase
- Infra
- Java
- Kafka
- Logs
- Mobile Logs
- MongoDB
- MySQL
- Nginx
- Nginx+
- Node.js
- PostgreSQL
- RabbitMQ
- Redis
- Hadoop
- Solr
- Solr Cloud
- Apache Spark
- Apache Storm
- Tomcat
- ZooKeeper
Getting Started¶
Setup¶
You'll need the following :
- Terraform v0.13+
- Sematext Cloud Account
- Sematext Cloud API Access Token
- Choice of Sematext Cloud Plan ID
Environment¶
Create the following environment variables:
export SEMATEXT_API_KEY="<your access key>" export SEMATEXT_REGION="<US or EU>"
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. main.tf
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 main.tf
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.
Further links to know more¶
- Terraform Registry Sematext Provider
- Sematext Provider Github
- Sematext Manual Integration Guide
- Terraform Website
- Terraform Mailing List [Google Groups]
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.