The ivkcs_agent_check resource
Name | Description | Format | Required | Resource recreation on value change |
|---|---|---|---|---|
| Service instance identifier | string | ||
| List of host names | list, list elements — string |
The resource specifies one or more methods for monitoring the state of service instances. The following monitoring methods are supported:
- Port availability check — described in the port_health block.
- Address availability check — described in the http_health block.
- Service instance availability check using scripts — described in the script_health block.
Each port is described by a separate port_health block.
Each address check is described by a separate http_health block.
Each script is described by a separate script_health block.
The ivkcs_agent_check resource returns the hash attribute (string format), which contains the hash of the monitoring result to be passed to the configuration management service.
resource "ivkcs_agent_check" "check1" {uuid = "<UUID>"hosts = ["<СПИСОК_ИМЕН_ХОСТОВ>"]http_health {protocol = "http"method = "GET"host = "127.0.0.1"path = "status"period = "1m"port = 11012http_codes = [200]}}
Here:
<UUID>— service instance identifier.<СПИСОК_ИМЕН_ХОСТОВ>— list of host names on which monitoring will be performed. Host names must exactly match the VM names defined in your Terraform configuration (usually in thevkcs_compute_instanceresource).
-
Using a local variable (recommended approach):
locals {hosts_name = "${substr(var.instance_uuid, 0, 8)}-myapp"}resource "ivkcs_agent_check" "health" {hosts = [local.hosts_name] # Use the value from localsuuid = var.instance_uuid# ...} -
Specifying the host name directly:
resource "ivkcs_agent_check" "health" {hosts = ["myapp-production-server"] # Specify a fixed host nameuuid = var.instance_uuid# ...} -
Specifying the host name via a variable in the
vkcs_compute_instanceresource:resource "vkcs_compute_instance" "app_server" {name = "app-production-vm" # Define a variable containing the host name# ...}resource "ivkcs_agent_check" "health" {hosts = [vkcs_compute_instance.app_server.name] # Use the value of the host name variableuuid = var.instance_uuid# ...}