Provides a ARMS Env Custom Job resource. Custom jobs in the arms environment.
For information about ARMS Env Custom Job and how to use it, see What is Env Custom Job.
Basic Usage
provider "alicloud" {
region = "cn-hangzhou"
}
resource "random_integer" "default" {
max = 99999
min = 10000
}
variable "name" {
default = "terraform-example"
}
resource "alicloud_vpc" "vpc" {
description = var.name
cidr_block = "172.16.0.0/12"
vpc_name = var.name
}
resource "alicloud_arms_environment" "env-ecs" {
environment_type = "ECS"
environment_name = "terraform-example-${random_integer.default.result}"
bind_resource_id = alicloud_vpc.vpc.id
environment_sub_type = "ECS"
}
resource "alicloud_arms_env_custom_job" "default" {
status = "run"
environment_id = alicloud_arms_environment.env-ecs.id
env_custom_job_name = var.name
config_yaml = <<EOF
scrape_configs:
- job_name: job-demo1
honor_timestamps: false
honor_labels: false
scrape_interval: 30s
scheme: http
metrics_path: /metric
static_configs:
- targets:
- 127.0.0.1:9090
EOF
aliyun_lang = "en"
}
The following arguments are supported:
aliyun_lang
- (Optional) The locale. The default is Chinese zh | en.config_yaml
- (Required) Yaml configuration string.env_custom_job_name
- (Required, ForceNew) Custom job name.environment_id
- (Required, ForceNew) Environment id.status
- (Optional, Computed) Status: run, stop.The following attributes are exported:
id
- The ID of the resource supplied above.The value is formulated as <environment_id>:<env_custom_job_name>
.The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 5 mins) Used when create the Env Custom Job.delete
- (Defaults to 5 mins) Used when delete the Env Custom Job.update
- (Defaults to 5 mins) Used when update the Env Custom Job.ARMS Env Custom Job can be imported using the id, e.g.
$ terraform import alicloud_arms_env_custom_job.example <environment_id>:<env_custom_job_name>