All Products
Search
Document Center

Application Real-Time Monitoring Service:Terraform overview

Last Updated:Mar 11, 2026

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

  1. Install Terraform on your local machine, or use Terraform in Cloud Shell.

  2. Configure the Alibaba Cloud provider in a main.tf file:

       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
       }
  3. Run terraform init to download the Alibaba Cloud provider.

  4. Define your Prometheus resources in .tf files, run terraform plan to preview changes, then run terraform apply to 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 .tf files.

  • 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

ResourceDescription
alicloud_arms_prometheusCreate and manage Prometheus instances.
alicloud_arms_environmentCreate and manage environment instances.

Monitoring configuration

ResourceDescription
alicloud_arms_prometheus_monitoringConfigure monitoring settings for a Prometheus instance, including ServiceMonitor, PodMonitor, custom jobs, and health inspection agents.
alicloud_arms_env_service_monitorManage the ServiceMonitor of an environment instance.
alicloud_arms_env_pod_monitorManage the PodMonitor of an environment instance.
alicloud_arms_env_custom_jobManage custom scrape jobs of an environment instance.

Integration and export

ResourceDescription
alicloud_arms_integration_exporterManage exporters in the Integration Center.
alicloud_arms_remote_writeManage remote write configurations of a Prometheus instance.

Add-ons and features

ResourceDescription
alicloud_arms_addon_releaseManage add-on packages of an environment instance.
alicloud_arms_env_featureManage environment features, including metric-agent, app-agent-pilot, service-check, and ebpf-agent.

Supported data sources

Data sourceDescription
alicloud_arms_prometheusList all Prometheus instances.
alicloud_arms_integration_exportersList exporters in the Integration Center.
alicloud_arms_remote_writeList 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.