Skip to content

Instantly share code, notes, and snippets.

@jugatsu
Created February 1, 2019 18:46
Show Gist options
  • Save jugatsu/e9e09db6c7cba6900fce2d275dba515f to your computer and use it in GitHub Desktop.
Save jugatsu/e9e09db6c7cba6900fce2d275dba515f to your computer and use it in GitHub Desktop.
terraform Yandex.Cloud snippet
provider "yandex" {
token = ""
cloud_id = ""
folder_id = ""
zone = "ru-central1-a"
}
data "yandex_compute_image" "win" {
family = "windows-2012r2-gvlk"
}
resource "yandex_compute_instance" "app" {
name = "app"
resources {
cores = 2
memory = 8
}
boot_disk {
initialize_params {
image_id = "${data.yandex_compute_image.win.image_id}"
type_id = "network-nvme"
size = "50"
}
}
network_interface {
subnet_id = "${yandex_vpc_subnet.subnet-1.id}"
nat = true
}
metadata {
user-data = <<EOF
#ps1
net user Administrator theW8aeZ
EOF
}
}
resource "yandex_vpc_network" "network-1" {
name = "network1"
}
resource "yandex_vpc_subnet" "subnet-1" {
name = "subnet1"
zone = "ru-central1-a"
network_id = "${yandex_vpc_network.network-1.id}"
v4_cidr_blocks = ["192.168.10.0/24"]
}
output "external_ip_address_app" {
value = "${yandex_compute_instance.app.network_interface.0.nat_ip_address}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment