Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
e449daa
Create GITLAB.md
vvyalov Oct 14, 2025
bd0e82a
Create Vagrantfile
vvyalov Oct 14, 2025
83715d2
Create docker-compose.yaml
vvyalov Oct 14, 2025
516bbf4
comment
Oct 30, 2025
473902e
comment
Nov 18, 2025
2997989
comment
Nov 18, 2025
21a3278
comment
Nov 18, 2025
63af6ec
comment
Nov 18, 2025
c2254cb
comment
Nov 18, 2025
cb8db0e
comment
Nov 24, 2025
b809234
comment
Nov 24, 2025
74804c7
comment
Nov 24, 2025
de4fb23
comment
Nov 24, 2025
23ec8d0
comment
Nov 24, 2025
b3b927c
comment
Nov 24, 2025
fa6b224
comment
Nov 24, 2025
800dd93
comment
Nov 24, 2025
6770418
comment
Nov 25, 2025
2bff198
comment
Dec 1, 2025
1bbfc0b
comment
Dec 1, 2025
5d193ae
comment
Dec 1, 2025
299a161
comment
Dec 1, 2025
9663c9c
comment
Dec 8, 2025
57787ae
comment
Dec 8, 2025
3948d7b
comment
Dec 8, 2025
84bd862
comment
Dec 8, 2025
db40264
comment
Dec 15, 2025
afe92a0
comment
Dec 15, 2025
af1af3f
comment
Dec 15, 2025
cc68680
comment
Dec 16, 2025
3a5120c
comment
Dec 16, 2025
0567e9a
comment
Jan 12, 2026
4ae661b
comment
Jan 13, 2026
406d84c
comment
Jan 13, 2026
4e76ea8
comment
Jan 19, 2026
56db7f1
comment
Jan 19, 2026
77cc04a
comment
Jan 20, 2026
83a1804
comment
Jan 20, 2026
987fbb5
comment
Jan 20, 2026
3b90bda
comment
Jan 20, 2026
d2dda19
comment
vvyalov Feb 2, 2026
a6cdff3
comment
vvyalov Feb 2, 2026
fd83c8c
comment
vvyalov Feb 2, 2026
5146f10
Initial commit
vvyalov Apr 23, 2026
be91dd0
Initial commit
vvyalov Apr 26, 2026
0e5fa91
Initial commit
vvyalov Apr 29, 2026
15eeee0
Initial commit
vvyalov May 3, 2026
a85bc48
Initial commit
vvyalov May 12, 2026
5d216b6
Initial commit
vvyalov May 14, 2026
0950e36
Initial commit
vvyalov May 14, 2026
5844ac2
Initial commit
vvyalov May 14, 2026
80d9f43
Initial commit
vvyalov May 18, 2026
ad2889d
Initial commit
vvyalov May 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 5 additions & 111 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,117 +1,11 @@
# Домашнее задание к занятию "`Название занятия`" - `Фамилия и имя студента`
# Домашнее задание к занятию "Управляющие конструкции в коде Terraform" - `Вялов Владислав`


### Инструкция по выполнению домашнего задания
## Задание 1

1. Сделайте `fork` данного репозитория к себе в Github и переименуйте его по названию или номеру занятия, например, https://github.com/имя-вашего-репозитория/git-hw или https://github.com/имя-вашего-репозитория/7-1-ansible-hw).
2. Выполните клонирование данного репозитория к себе на ПК с помощью команды `git clone`.
3. Выполните домашнее задание и заполните у себя локально этот файл README.md:
- впишите вверху название занятия и вашу фамилию и имя
- в каждом задании добавьте решение в требуемом виде (текст/код/скриншоты/ссылка)
- для корректного добавления скриншотов воспользуйтесь [инструкцией "Как вставить скриншот в шаблон с решением](https://github.com/netology-code/sys-pattern-homework/blob/main/screen-instruction.md)
- при оформлении используйте возможности языка разметки md (коротко об этом можно посмотреть в [инструкции по MarkDown](https://github.com/netology-code/sys-pattern-homework/blob/main/md-instruction.md))
4. После завершения работы над домашним заданием сделайте коммит (`git commit -m "comment"`) и отправьте его на Github (`git push origin`);
5. Для проверки домашнего задания преподавателем в личном кабинете прикрепите и отправьте ссылку на решение в виде md-файла в вашем Github.
6. Любые вопросы по выполнению заданий спрашивайте в чате учебной группы и/или в разделе “Вопросы по заданию” в личном кабинете.

Желаем успехов в выполнении домашнего задания!

### Дополнительные материалы, которые могут быть полезны для выполнения задания
![alt text](img/1.jpg)

1. [Руководство по оформлению Markdown файлов](https://gist.github.com/Jekins/2bf2d0638163f1294637#Code)

---
## Задание 4

### Задание 1

`Приведите ответ в свободной форме........`

1. `Заполните здесь этапы выполнения, если требуется ....`
2. `Заполните здесь этапы выполнения, если требуется ....`
3. `Заполните здесь этапы выполнения, если требуется ....`
4. `Заполните здесь этапы выполнения, если требуется ....`
5. `Заполните здесь этапы выполнения, если требуется ....`
6.

```
Поле для вставки кода...
....
....
....
....
```

`При необходимости прикрепитe сюда скриншоты
![Название скриншота 1](ссылка на скриншот 1)`


---

### Задание 2

`Приведите ответ в свободной форме........`

1. `Заполните здесь этапы выполнения, если требуется ....`
2. `Заполните здесь этапы выполнения, если требуется ....`
3. `Заполните здесь этапы выполнения, если требуется ....`
4. `Заполните здесь этапы выполнения, если требуется ....`
5. `Заполните здесь этапы выполнения, если требуется ....`
6.

```
Поле для вставки кода...
....
....
....
....
```

`При необходимости прикрепитe сюда скриншоты
![Название скриншота 2](ссылка на скриншот 2)`


---

### Задание 3

`Приведите ответ в свободной форме........`

1. `Заполните здесь этапы выполнения, если требуется ....`
2. `Заполните здесь этапы выполнения, если требуется ....`
3. `Заполните здесь этапы выполнения, если требуется ....`
4. `Заполните здесь этапы выполнения, если требуется ....`
5. `Заполните здесь этапы выполнения, если требуется ....`
6.

```
Поле для вставки кода...
....
....
....
....
```

`При необходимости прикрепитe сюда скриншоты
![Название скриншота](ссылка на скриншот)`

### Задание 4

`Приведите ответ в свободной форме........`

1. `Заполните здесь этапы выполнения, если требуется ....`
2. `Заполните здесь этапы выполнения, если требуется ....`
3. `Заполните здесь этапы выполнения, если требуется ....`
4. `Заполните здесь этапы выполнения, если требуется ....`
5. `Заполните здесь этапы выполнения, если требуется ....`
6.

```
Поле для вставки кода...
....
....
....
....
```

`При необходимости прикрепитe сюда скриншоты
![Название скриншота](ссылка на скриншот)`
![alt text](img/2.jpg)
Binary file added img/1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed img/img15.png
Binary file not shown.
Binary file removed img/img16.png
Binary file not shown.
Binary file removed img/img17.png
Binary file not shown.
Binary file removed img/img18.png
Binary file not shown.
Binary file removed img/img19.png
Binary file not shown.
Binary file removed img/img20.png
Binary file not shown.
52 changes: 0 additions & 52 deletions md-instruction.md

This file was deleted.

18 changes: 0 additions & 18 deletions screen-instruction.md

This file was deleted.

12 changes: 12 additions & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Local .terraform directories and files
**/.terraform/*
.terraform*

!.terraformrc

# .tfstate files
*.tfstate
*.tfstate.*

# own secret vars store.
personal.auto.tfvars
9 changes: 9 additions & 0 deletions src/.terraformrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
provider_installation {
network_mirror {
url = "https://terraform-mirror.yandexcloud.net/"
include = ["registry.terraform.io/*/*"]
}
direct {
exclude = ["registry.terraform.io/*/*"]
}
}
Empty file added src/ansible.tf
Empty file.
Empty file added src/count-vm.tf
Empty file.
Empty file added src/disk_vm.tf
Empty file.
Empty file added src/for_each-vm.tf
Empty file.
Empty file added src/inventory.tmpl
Empty file.
9 changes: 9 additions & 0 deletions src/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "yandex_vpc_network" "develop" {
name = var.vpc_name
}
resource "yandex_vpc_subnet" "develop" {
name = var.vpc_name
zone = var.default_zone
network_id = yandex_vpc_network.develop.id
v4_cidr_blocks = var.default_cidr
}
42 changes: 42 additions & 0 deletions src/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
output "web_vm_ips" {
description = "External IP addresses of web VMs"
value = {
for i, vm in yandex_compute_instance.web :
vm.name => vm.network_interface[0].nat_ip_address
}
}

output "db_vm_ips" {
description = "External IP addresses of database VMs"
value = {
for name, vm in yandex_compute_instance.db-vm :
name => vm.network_interface[0].nat_ip_address
}
}

output "storage_vm_ip" {
description = "External IP address of storage VM"
value = yandex_compute_instance.storage.network_interface[0].nat_ip_address
}

output "vms_fqdn" {
description = "FQDN of all created VMs"
value = {
web = {
for vm in yandex_compute_instance.web :
vm.name => vm.fqdn
}
db = {
for name, vm in yandex_compute_instance.db-vm :
name => vm.fqdn
}
storage = {
storage = yandex_compute_instance.storage.fqdn
}
}
}

output "inventory_file" {
description = "Path to generated Ansible inventory"
value = local_file.ansible_inventory.filename
}
3 changes: 3 additions & 0 deletions src/personal.auto.tfvars_example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
token = ""
cloud_id = ""
folder_id = ""
15 changes: 15 additions & 0 deletions src/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
terraform {
required_providers {
yandex = {
source = "yandex-cloud/yandex"
}
}
required_version = "~>1.12.0"
}

provider "yandex" {
token = var.token
cloud_id = var.cloud_id
folder_id = var.folder_id
zone = var.default_zone
}
86 changes: 86 additions & 0 deletions src/security.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
variable "security_group_ingress" {
description = "secrules ingress"
type = list(object(
{
protocol = string
description = string
v4_cidr_blocks = list(string)
port = optional(number)
from_port = optional(number)
to_port = optional(number)
}))
default = [
{
protocol = "TCP"
description = "разрешить входящий ssh"
v4_cidr_blocks = ["0.0.0.0/0"]
port = 22
},
{
protocol = "TCP"
description = "разрешить входящий http"
v4_cidr_blocks = ["0.0.0.0/0"]
port = 80
},
{
protocol = "TCP"
description = "разрешить входящий https"
v4_cidr_blocks = ["0.0.0.0/0"]
port = 443
},
]
}


variable "security_group_egress" {
description = "secrules egress"
type = list(object(
{
protocol = string
description = string
v4_cidr_blocks = list(string)
port = optional(number)
from_port = optional(number)
to_port = optional(number)
}))
default = [
{
protocol = "TCP"
description = "разрешить весь исходящий трафик"
v4_cidr_blocks = ["0.0.0.0/0"]
from_port = 0
to_port = 65365
}
]
}


resource "yandex_vpc_security_group" "example" {
name = "example_dynamic"
network_id = yandex_vpc_network.develop.id
folder_id = var.folder_id

dynamic "ingress" {
for_each = var.security_group_ingress
content {
protocol = lookup(ingress.value, "protocol", null)
description = lookup(ingress.value, "description", null)
port = lookup(ingress.value, "port", null)
from_port = lookup(ingress.value, "from_port", null)
to_port = lookup(ingress.value, "to_port", null)
v4_cidr_blocks = lookup(ingress.value, "v4_cidr_blocks", null)
}
}

dynamic "egress" {
for_each = var.security_group_egress
content {
protocol = lookup(egress.value, "protocol", null)
description = lookup(egress.value, "description", null)
port = lookup(egress.value, "port", null)
from_port = lookup(egress.value, "from_port", null)
to_port = lookup(egress.value, "to_port", null)
v4_cidr_blocks = lookup(egress.value, "v4_cidr_blocks", null)
}
}
}
Loading