/terraform-yandex-compute

Terraform module which creates Compute resources on Yandex Cloud

Primary LanguageHCLApache License 2.0Apache-2.0

Terraform module for Yandex.Cloud Compute

Terraform module which creates compute instance on Yandex.Cloud.

Usage

Before using this module, you need to configure provider (or copy versions.tf):

terraform {
  required_version = ">= 0.13"

  required_providers {
    yandex = {
      source  = "yandex-cloud/yandex"
      version = ">= 0.47.0"
    }

  }
}

Preemtible instance (Spot instance)

module "compute" {
  source  = "glavk/compute/yandex"
  version = "0.1.13"

  image_family = "ubuntu-docker"
  subnet       = "sn-dev-0"
  folder_id    = "xxx"

  name     = "development"
  hostname = "dev"
  is_nat   = true

  cores  = 2
  memory = 4
  size   = "10"

  preemptible = true

  sg_id = ["xxx"]

}

Examples

Requirements

Name Version
terraform >= 0.13
yandex >= 0.47.0

Providers

Name Version
yandex >= 0.47.0

Inputs

Name Description Type Default Required
core_fraction Baseline performance for a core as a percent number 100 no
cores CPU cores for the instance number 2 no
folder_id Yandex Cloud Folder ID where resources will be created string n/a yes
hostname Host name for the instance. This field is used to generate the instance fqdn value string n/a yes
image_family Yandex Cloud Compute Image family string n/a yes
is_nat Provide a public address for instance to access the internet over NAT bool false no
memory Memory size for the instance in GB number 2 no
name Yandex Cloud Compute (VM) name string n/a yes
nat_ip_address Public IP address for instance to access the internet over NAT string "" no
platform_id The type of virtual machine to create string "standard-v2" no
preemptible Specifies if the instance is preemptible bool false no
sg_id Security group ids for network interface list(string) n/a yes
size Size of the boot disk in GB string "10" no
ssh_pubkey SSH public key for access to the instance string "~/.ssh/id_rsa.pub" no
ssh_username User for SSH access to the instance string "ubuntu" no
subnet Yandex VPC subnet string n/a yes
zones Yandex Cloud Zones for provisoned resources list(string)
[
"ru-central1-a",
"ru-central1-b",
"ru-central1-c"
]
no

Outputs

Name Description
compute_instance_external_ip The external IP address of the instance
compute_instance_fqdn The fully qualified DNS name of this instance
compute_instance_internal_ip The internal IP address of the instance