VK Cloud logo

The ivkcs_agent_check resource

Resource arguments

Name

Description

Format

Required

Resource recreation on value change

uuid

Service instance identifier

string

The ivkcs_agent_check resource

The ivkcs_agent_check resource

hosts

List of host names

list, list elements — string

The ivkcs_agent_check resource

The ivkcs_agent_check resource

The resource specifies one or more methods for monitoring the state of service instances. The following monitoring methods are supported:

port_health block

Each port is described by a separate port_health block.

http_health block

Each address check is described by a separate http_health block.

script_health block

Each script is described by a separate script_health block.

Returned parameters

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.

Example of resource description

resource "ivkcs_agent_check" "check1" {    uuid = "<UUID>"	hosts = ["<СПИСОК_ИМЕН_ХОСТОВ>"]	http_health {		protocol = "http"		method = "GET"		host = "127.0.0.1"		path = "status"		period = "1m"		port = 11012		http_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 the vkcs_compute_instance resource).

Examples of specifying host names

  • 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_instance resource:

    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# ...}
Was this article helpful?