Status200 Terraform Provider
The Status200 Terraform Provider allows you to manage Status200 resources using Infrastructure as Code (IaC). This provider enables you to configure monitoring, incident management, status pages, and other Status200 features through Terraform.
Table of Contents
- Installation
- Provider Configuration
- Quick Start
- Version Compatibility
- Available Resources
- Examples
- Best Practices
- Migration Guide
Installation
From Terraform Registry (Recommended)
The Status200 Terraform provider is available on the Terraform Registry.
terraform {
required_providers {
status200 = {
source = "status200/status200"
version = "~> 7.0" # Use latest 7.x version
}
}
required_version = ">= 1.0"
}Version Pinning for Self-Hosted Installations
⚠️ Important for Self-Hosted Customers: Always pin the Terraform provider version to match your Status200 installation version to ensure API compatibility.
terraform {
required_providers {
status200 = {
source = "status200/status200"
version = "= 7.0.123" # Pin to exact version matching your Status200 installation
}
}
required_version = ">= 1.0"
}Finding Your Status200 Version
You can find your Status200 version in several ways:
- Dashboard: Go to Settings → About in your Status200 dashboard
- API: Call
GET /api/statusendpoint - Docker: Check the image tag you're using
- Helm: Check your Helm chart version
# Example: If running Status200 7.0.123
terraform {
required_providers {
status200 = {
source = "status200/status200"
version = "= 7.0.123"
}
}
}Provider Configuration
Basic Configuration
provider "status200" {
status200_url = "https://your-status200-instance.com" # Or https://status200.ru for cloud
api_key = var.status200_api_key
}Environment Variables
You can configure the provider using environment variables:
export S200_URL="https://your-status200-instance.ru"
export S200_API_KEY="your-api-key-here"Then use the provider without explicit configuration:
provider "status200" {
# Configuration will be read from environment variables
}Configuration Options
| Argument | Environment Variable | Description | Required |
|---|---|---|---|
status200_url | S200_URL | Status200 URL | Yes |
api_key | S200_API_KEY | Status200 API Key | Yes |
Quick Start
1. Create API Key
First, create an API key in your Status200 dashboard:
- Go to Settings → API Keys
- Click Create API Key
- Give it a descriptive name (e.g., "Terraform Automation")
- Select appropriate permissions
- Copy the generated API key
2. Basic Terraform Configuration
Create a main.tf file:
terraform {
required_providers {
status200 = {
source = "status200/status200"
version = "~> 7.0"
}
}
}
provider "status200" {
status200_url = "https://status200.ru" # Use your instance URL
api_key = var.status200_api_key
}
# Note: Projects must be created manually in the Status200 dashboard
variable "project_id" {
description = "Status200 project ID"
type = string
}
# Create a monitor
resource "status200_monitor" "website" {
name = "Website Monitor"
description = "Monitor for website uptime"
data = jsonencode({
url = "https://example.ru"
interval = "5m"
timeout = "30s"
})
}
# Create a team
resource "status200_team" "platform" {
name = "Platform Team"
description = "Platform engineering team"
}
value = "alerts@example.ru"
}
}3. Initialize and Apply
# Initialize Terraform
terraform init
# Plan the changes
terraform plan
# Apply the configuration
terraform applyVersion Compatibility
Cloud Customers
For Status200 Cloud customers, use the latest provider version:
terraform {
required_providers {
status200 = {
source = "status200/status200"
version = "~> 7.0" # Always use latest compatible version
}
}
}Self-Hosted Customers
Critical: Self-hosted customers must pin the provider version to match their Status200 installation:
| Status200 Version | Provider Version | Configuration |
|---|---|---|
| 7.0.x | 7.0.x | version = "~> 7.0.0" |
| 7.1.x | 7.1.x | version = "~> 7.1.0" |
| 7.2.x | 7.2.x | version = "~> 7.2.0" |
Example for Status200 7.0.123:
terraform {
required_providers {
status200 = {
source = "status200/status200"
version = "= 7.0.123" # Exact version match
}
}
}Available Resources
The Status200 Terraform provider supports the following resources:
Core Resources
status200_team- Manage teams
Monitoring
status200_monitor- Create and manage monitorsstatus200_probe- Manage monitoring probes
On-Call Management
status200_on_call_duty_policy- Set up on-call schedules
Status Pages
status200_status_page- Create status pages
Service Catalog
status200_service_catalog- Manage service catalog entries
Service Catalog
status200_service- Define servicesstatus200_service_dependency- Map service dependencies
Data Sources
Note: Data sources are not currently available in the provider as no datasources are defined in the provider schema.
Examples
Complete Monitoring Setup
# Variables
variable "status200_api_key" {
description = "Status200 API Key"
type = string
sensitive = true
}
variable "project_id" {
description = "Status200 project ID (create project manually in dashboard)"
type = string
}
variable "status200_url" {
description = "Status200 URL"
type = string
default = "https://status200.ru"
}
# Provider configuration
terraform {
required_providers {
status200 = {
source = "status200/status200"
version = "~> 7.0"
}
}
}
provider "status200" {
status200_url = var.status200_url
api_key = var.status200_api_key
}
# Team
resource "status200_team" "platform" {
name = "Platform Team"
description = "Platform engineering team"
}
# Monitors
resource "status200_monitor" "api" {
name = "API Health Check"
description = "Monitor for API health endpoint"
data = jsonencode({
url = "https://api.mycompany.ru/health"
method = "GET"
interval = "1m"
timeout = "30s"
})
}
}
resource "status200_monitor" "database" {
name = "Database Connection"
project_id = status200_project.production.id
monitor_type = "port"
hostname = "db.mycompany.ru"
port = 5432
interval = "2m"
tags = {
service = "database"
environment = "production"
criticality = "critical"
}
}
# On-call policy
resource "status200_on_call_policy" "platform_oncall" {
name = "Platform On-Call"
project_id = status200_project.production.id
team_id = status200_team.platform.id
schedules {
name = "Business Hours"
timezone = "America/New_York"
layers {
name = "Primary"
users = ["user1@mycompany.ru", "user2@mycompany.ru"]
rotation_type = "weekly"
start_time = "09:00"
end_time = "17:00"
days = ["monday", "tuesday", "wednesday", "thursday", "friday"]
}
}
}
# Alert policy
resource "status200_alert_policy" "critical_alerts" {
name = "Critical System Alerts"
project_id = status200_project.production.id
conditions {
monitor_id = status200_monitor.api.id
threshold = "down"
}
conditions {
monitor_id = status200_monitor.database.id
threshold = "down"
}
actions {
type = "webhook"
url = "https://hooks.slack.ru/services/YOUR/SLACK/WEBHOOK"
}
actions {
type = "oncall_escalation"
oncall_policy_id = status200_on_call_policy.platform_oncall.id
}
}
# Status page
resource "status200_status_page" "public" {
name = "MyCompany Status"
project_id = status200_project.production.id
domain = "status.mycompany.ru"
components {
name = "API"
monitor_id = status200_monitor.api.id
}
components {
name = "Database"
monitor_id = status200_monitor.database.id
}
}Self-Hosted Configuration Example
# For self-hosted Status200 instance version 7.0.123
terraform {
required_providers {
status200 = {
source = "status200/status200"
version = "= 7.0.123" # Must match your Status200 version exactly
}
}
required_version = ">= 1.0"
}
provider "status200" {
status200_url = "https://status200.mycompany.ru" # Your self-hosted URL
api_key = var.status200_api_key
}
# Rest of your configuration...Best Practices
1. Version Management
For Cloud Customers:
- Use semantic versioning with
~>to get compatible updates - Review changelog before major version upgrades
For Self-Hosted Customers:
- Always pin to exact version matching your installation
- Update provider version when you upgrade Status200
- Test in non-production environment first
2. State Management
terraform {
backend "s3" {
bucket = "my-terraform-state"
key = "status200/terraform.tfstate"
region = "us-west-2"
}
}3. Environment Separation
Use workspaces or separate state files for different environments:
# Using workspaces
terraform workspace new production
terraform workspace new staging
# Using separate directories
mkdir -p environments/{staging,production}4. Variable Management
# variables.tf
variable "environment" {
description = "Environment name"
type = string
}
variable "monitors" {
description = "List of monitors to create"
type = list(object({
name = string
url = string
type = string
}))
}
# terraform.tfvars
environment = "production"
monitors = [
{
name = "Website"
url = "https://example.ru"
type = "website"
},
{
name = "API"
url = "https://api.example.ru/health"
type = "api"
}
]5. Resource Naming
Use consistent naming conventions:
resource "status200_monitor" "website_production" {
name = "${var.environment}-website-monitor"
# ...
}
resource "status200_alert_policy" "critical_production" {
name = "${var.environment}-critical-alerts"
# ...
}Migration Guide
From Manual Configuration
- Audit existing resources in Status200 dashboard
- Create Terraform configuration for existing resources
- Import existing resources to Terraform state
- Validate configuration matches current state
- Apply changes incrementally
Example import:
# Import existing monitor
terraform import status200_monitor.website monitor-id-here
# Import existing project
terraform import status200_project.main project-id-hereVersion Upgrades
When upgrading Status200 (self-hosted):
- Backup your current state
- Check provider compatibility
- Update provider version in configuration
- Test in staging environment
- Apply to production
# Backup state
terraform state pull > backup.tfstate
# Update provider version
# Edit terraform block in your configuration
# Plan and apply
terraform init -upgrade
terraform plan
terraform applySupport and Resources
- Documentation: Status200 Docs
- Terraform Registry: Status200 Provider
- GitHub Issues: Status200 GitHub
- Community: Status200 Community
Troubleshooting
Common Issues
Version Mismatch (Self-Hosted)
Error: API version incompatibleSolution: Ensure provider version matches Status200 installation
Authentication Issues
Error: Invalid API keySolution: Verify API key and permissions
Resource Not Found
Error: Resource not foundSolution: Check resource IDs and ensure resource exists
Debug Mode
Enable detailed logging:
export TF_LOG=DEBUG
terraform applyVersion Check
Verify your setup:
# Check Terraform version
terraform version
# Check provider version
terraform providers
# Validate configuration
terraform validate