mirror of
https://github.com/Dannecron/netology-devops.git
synced 2025-12-26 07:42:36 +03:00
add homework 7.3, complete task 1
This commit is contained in:
42
src/homework/07-terraform/7.3/terraform/main.tf
Normal file
42
src/homework/07-terraform/7.3/terraform/main.tf
Normal 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")}"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user