VK Cloud logo

Input variables for resource configuration

Describe the input variables for resource configuration. Variables can be conditionally divided into the groups shown in table 1.

Table 1 — Terraform variables

Group

Description

Possible types

Special

Variables that allow using data received from the broker.

The following variables are supported:

  • instance_uuid — the service deployment identifier. Used in the description of most iVK CS provider resources.
  • email — the email of the user who connected the service.

When such variables are declared in the manifest, their values will be obtained by Terraform automatically

string

External

Variables that allow setting values of tariff options configured in the tariff plan configuration wizard.

The variable name must match the name of the tariff option YAML file.

Besides declaring such a variable in the manifest, it must also be:

  • Described as a tariff option in its YAML file.
  • Specified in the tariff plan (file plans/<PLAN_NAME>/plan.yaml).
  • Specified in the tariff plan configuration wizard (file plans/<PLAN_NAME>/display.yaml).

A default value can be set for an external variable. It will be applied if the external value cannot be obtained

number, string, boolean

Local

Variables used only in the manifest. Set the value in the default argument when declaring the variable

Types supported by Terraform

Example of declaring special variables
# Service deployment identifiervariable "instance_uuid" {  type    = string}# User emailvariable "email" {  type    = string}
Example of declaring external and local variables
# Name of the virtual network where the VM will be createdvariable "sub_network" {  type    = string  default = "test-net"}# Number of CPUs for the VMvariable "flavor_vcpus" {  type    = number  default = 2}

When describing input variables, you can use locals blocks. With them, you can define variables using computations, including computations based on other declared variables.

Was this article helpful?