Terraform Provider Quick Start Guide
This guide will help you get started with the Status200 Terraform Provider in just a few minutes.
Prerequisites
- Terraform >= 1.0 installed
- Status200 account (Cloud or Self-Hosted)
- Status200 API key
Step 1: Create API Key
For Status200 Cloud
- Go to Status200 Cloud and log in
- Navigate to Settings → API Keys
- Click Create API Key
- Name it "Terraform Provider"
- Select required permissions
- Copy the generated API key
For Self-Hosted Status200
- Access your Status200 instance
- Navigate to Settings → API Keys
- Click Create API Key
- Name it "Terraform Provider"
- Select required permissions
- Copy the generated API key
Step 2: Create Terraform Configuration
Create a new directory and main.tf file:
terraform {
required_providers {
status200 = {
source = "status200/status200"
# For Cloud customers
version = "~> 7.0"
# For Self-Hosted customers - pin to your exact version
# version = "= 7.0.123" # Replace with your Status200 version
}
}
required_version = ">= 1.0"
}
provider "status200" {
# For Cloud customers
status200_url = "https://status200.ru"
# For Self-Hosted customers - use your instance URL
# status200_url = "https://status200.yourcompany.com"
api_key = var.status200_api_key
}
variable "status200_api_key" {
description = "Status200 API Key"
type = string
sensitive = true
}
# Note: Projects must be created manually in the Status200 dashboard
# Use your existing project ID here
variable "project_id" {
description = "Status200 project ID"
type = string
}
# Create a simple website monitor
resource "status200_monitor" "website" {
name = "Website Monitor"
description = "Monitor for website uptime"
data = jsonencode({
url = "https://example.com"
interval = "5m"
timeout = "30s"
})
}
# Output the monitor ID
output "monitor_id" {
value = status200_monitor.website.id
}Step 3: Create Variables File
Create terraform.tfvars:
# terraform.tfvars
status200_api_key = "your-api-key-here"
project_id = "your-project-id-here" # Get this from Status200 dashboardImportant: Add terraform.tfvars to your .gitignore to keep API keys secret!
Step 4: Initialize and Apply
# Initialize Terraform
terraform init
# Plan the deployment
terraform plan
# Apply the configuration
terraform applyStep 5: Verify Resources
- Check your Status200 dashboard
- Go to your existing project
- Verify the "Website Monitor" is created and running
Next Steps
- Explore More Resources: Check the full documentation for all available resources
- Set Up Alerting: Add alert policies and notification channels
- Create Status Pages: Set up public status pages for your services
- Organize with Teams: Create teams and assign permissions
Version-Specific Examples
Cloud Customers (Latest Version)
terraform {
required_providers {
status200 = {
source = "status200/status200"
version = "~> 7.0" # Always gets latest compatible 7.x version
}
}
}
provider "status200" {
status200_url = "https://status200.ru"
api_key = var.status200_api_key
}Self-Hosted Customers (Version Pinned)
terraform {
required_providers {
status200 = {
source = "status200/status200"
version = "= 7.0.123" # Must match your Status200 version exactly
}
}
}
provider "status200" {
status200_url = "https://status200.mycompany.com" # Your self-hosted URL
api_key = var.status200_api_key
}Troubleshooting Quick Start
Issue: Provider not found
Error: Failed to query available provider packagesSolution: Run terraform init to download the provider
Issue: Authentication failed
Error: Invalid API keySolution:
- Verify your API key in Status200 dashboard
- Check the API key has sufficient permissions
- Ensure
status200_urlis correct for your instance
Issue: Version mismatch (Self-Hosted)
Error: API version incompatibleSolution:
- Check your Status200 version in the dashboard
- Update the provider version to match exactly
- Run
terraform init -upgrade
Clean Up
To remove all resources created in this quick start:
terraform destroyThis will delete the monitor and project created during the quick start.