add homework 7.3, complete task 1

This commit is contained in:
2022-06-23 14:11:59 +07:00
parent d0c2a3e7ab
commit 55f07be3d0
10 changed files with 233 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
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 "internal_ip_address_vm_1" {
value = yandex_compute_instance.vm-1.network_interface.0.ip_address
}
output "external_ip_address_vm_1" {
value = yandex_compute_instance.vm-1.network_interface.0.nat_ip_address
}
resource "yandex_compute_instance" "vm-1" {
name = "test-vm-1"
resources {
cores = 2
memory = 2
}
boot_disk {
initialize_params {
image_id = "fd81hgrcv6lsnkremf32" # ubuntu-20-04-lts-v20210908
}
}
network_interface {
subnet_id = yandex_vpc_subnet.subnet-1.id
nat = true
}
metadata = {
ssh-keys = "ubuntu:${file("~/.ssh/id_rsa.pub")}"
}
}