Managed Service for Prometheus provides Terraform resources and data sources that let you automate the deployment and configuration of your monitoring infrastructure. Define Prometheus instances, exporters, and monitoring configurations in version-controlled .tf files and apply the same setup across development, staging, and production environments.
Quick start
Install Terraform on your local machine, or use Terraform in Cloud Shell.
Configure the Alibaba Cloud provider in a
main.tffile:terraform { required_providers { alicloud = { source = "aliyun/alicloud" version = ">= 1.0.0" } } } provider "alicloud" { access_key = var.access_key secret_key = var.secret_key region = var.region }Run
terraform initto download the Alibaba Cloud provider.Define your Prometheus resources in
.tffiles, runterraform planto preview changes, then runterraform applyto create the resources.
For step-by-step guides, see Related operations.
Benefits
Repeatable deployments: Apply the same Prometheus configuration across multiple environments from version-controlled
.tffiles.Multi-cloud consistency: Manage Alibaba Cloud resources alongside other cloud providers using the same workflow.
Automated provisioning: Create templates that provision monitoring resources predictably, reducing manual errors.
Infrastructure as code: Terraform stores a copy of the current state of your infrastructure, so you can track changes to components and share configurations with other users.
Change visibility: Preview infrastructure changes before applying them. The plan-and-apply workflow shows exactly what will be created, modified, or deleted.
Reduced development costs: Create development and deployment environments based on your requirements to evaluate costs before making changes.
Supported resources
Managed Service for Prometheus supports the following Terraform resources, grouped by function.
Instance management
| Resource | Description |
|---|---|
| alicloud_arms_prometheus | Create and manage Prometheus instances. |
| alicloud_arms_environment | Create and manage environment instances. |
Monitoring configuration
| Resource | Description |
|---|---|
| alicloud_arms_prometheus_monitoring | Configure monitoring settings for a Prometheus instance, including ServiceMonitor, PodMonitor, custom jobs, and health inspection agents. |
| alicloud_arms_env_service_monitor | Manage the ServiceMonitor of an environment instance. |
| alicloud_arms_env_pod_monitor | Manage the PodMonitor of an environment instance. |
| alicloud_arms_env_custom_job | Manage custom scrape jobs of an environment instance. |
Integration and export
| Resource | Description |
|---|---|
| alicloud_arms_integration_exporter | Manage exporters in the Integration Center. |
| alicloud_arms_remote_write | Manage remote write configurations of a Prometheus instance. |
Add-ons and features
| Resource | Description |
|---|---|
| alicloud_arms_addon_release | Manage add-on packages of an environment instance. |
| alicloud_arms_env_feature | Manage environment features, including metric-agent, app-agent-pilot, service-check, and ebpf-agent. |
Supported data sources
| Data source | Description |
|---|---|
| alicloud_arms_prometheus | List all Prometheus instances. |
| alicloud_arms_integration_exporters | List exporters in the Integration Center. |
| alicloud_arms_remote_write | List remote write configurations of a Prometheus instance. |
Alibaba Cloud Terraform provider
The Alibaba Cloud Provider (terraform-provider-alicloud) connects Terraform to Alibaba Cloud APIs. It provides 163 resources and 113 data sources across 35 services, including computing, storage, networking, load balancing, CDN, middleware, access control, and database services. For a full list of providers, see Terraform Registry.
For more information about Terraform, see terraform.io. For common Terraform use cases on Alibaba Cloud, see Scenarios.