Skip to content

Terraform module to manage Compute Instance resources within the Yandex.Cloud.

License

Notifications You must be signed in to change notification settings

terraform-yacloud-modules/terraform-yandex-instance

Repository files navigation

Yandex Cloud VM Instance Terraform module

Terraform module which creates Yandex Cloud Instance resources.

Examples

Examples codified under the examples are intended to give users references for how to use the module(s) as well as testing/validating changes to the source code of the module. If contributing to the project, please be sure to make any appropriate updates to the relevant examples to allow maintainers to test your changes and to keep the examples up to date for users. Thank you!

Requirements

Name Version
terraform >= 1.3
tls >= 3.1.0
yandex >= 0.72.0

Providers

Name Version
tls >= 3.1.0
yandex >= 0.72.0

Modules

No modules.

Resources

Name Type
tls_private_key.this resource
yandex_compute_disk.this resource
yandex_compute_instance.this resource
yandex_vpc_address.main resource
yandex_client_config.client data source
yandex_compute_image.this data source

Inputs

Name Description Type Default Required
allow_stopping_for_update Allow stop the instance in order to update properties bool true no
boot_disk Basic boot disk parameters
object({
auto_delete = optional(bool)
device_name = optional(string)
mode = optional(string)
disk_id = optional(string, null)
})
{} no
boot_disk_initialize_params Additional boot disk parameters
object({
size = optional(number, 10)
block_size = optional(number, 4096)
type = optional(string, "network-hdd")
})
{} no
core_fraction Core fraction applied to the instance number null no
cores Cores allocated to the instance number 2 no
create_pip Create public IP address for instance; If true public_ip_address will be ignored bool true no
description Instance description string null no
docker_compose The key in the VM metadata that uses the docker-compose specification string null no
enable_ipv4 Allocate an IPv4 address for the interface string true no
enable_ipv6 Allocate an IPv6 address for the interface string false no
enable_nat Enable public IPv4 address bool null no
enable_oslogin Enable OS Login string false no
folder_id Folder ID string null no
generate_ssh_key If true, SSH key will be generated for instance group string true no
hostname Hostname of the instance. More info: https://cloud.yandex.ru/docs/compute/concepts/network#hostname string null no
image_family Default image family name (lowest priority) string "ubuntu-2004-lts" no
image_id Image ID (medium priority) string null no
image_snapshot_id Image snapshot id to initialize from.
Highest priority over var.image_id
and var.image_family"
string null no
labels A set of labels which will be applied to all resources map(string) {} no
memory Memory allocated to the instance (in Gb) number 2 no
name Name which will be used for all resources string n/a yes
network_acceleration_type Network acceleration type string "standard" no
placement_affinity_rules List of host affinity rules
list(object({
key = string
op = string
value = list(string)
}))
[] no
placement_group_id Placement group ID string "" no
platform_id Hardware CPU platform name (Intel Ice Lake by default) string "standard-v3" no
preemptible Make instance preemptible bool false no
private_ip_address Private IP address to assign to the instance. If empty, the address will be automatically assigned from the specified subnet string null no
private_ipv6_address Private IPv6 address to assign to the instance. If empty, the address will be automatically assigned from the specified subnet string null no
public_ip_address Public IP address to assign to the instance string null no
secondary_disks Additional disks with params
map(object({
enabled = optional(bool, true)
auto_delete = optional(bool, false)
mode = optional(string)
labels = optional(map(string), {})
type = optional(string, "network-hdd")
size = optional(number, 10)
block_size = optional(number, 4096)
device_name = optional(string)
}))
{} no
security_group_ids Security group IDs linked to the instance list(string) null no
serial_port_enable Enable serial port on the instance bool false no
service_account_id ID of the service account authorized for instance string null no
ssh_pubkey Public RSA key path to inject string null no
ssh_user Initial SSH username for instance string "ubuntu" no
subnet_id VPC Subnet ID string n/a yes
user_data Cloud-init user-data string null no
zone Network zone string null no

Outputs

Name Description
compute_disks Secondary disk's data
instance_id Compute instance ID
instance_private_ip Compute instance private IP
instance_public_ip Compute instance public IP
ssh_key_prv Private SSH key
ssh_key_pub Public SSH key

License

Apache-2.0 Licensed. See LICENSE.