vpc.tf 1.0 KB

1234567891011121314151617181920212223242526272829
  1. # Создание VPC сети
  2. resource "yandex_vpc_network" "vpc-web-app" {
  3. name = "vpc-web-app"
  4. folder_id = var.FOLDER_ID
  5. }
  6. # Создание подсетей в prod folder
  7. resource "yandex_vpc_subnet" "prod-subnet" {
  8. folder_id = data.yandex_resourcemanager_folder.prod-folder.id
  9. count = 3
  10. name = "prod-${element(var.network_names, count.index)}"
  11. zone = element(var.zones, count.index)
  12. network_id = yandex_vpc_network.vpc-web-app.id
  13. v4_cidr_blocks = [element(var.app_cidrs3, count.index)]
  14. }
  15. # Создание подсетей в non-prod folder
  16. resource "yandex_vpc_subnet" "non-prod-subnet" {
  17. folder_id = data.yandex_resourcemanager_folder.nonprod-folder.id
  18. count = 3
  19. name = "non-prod-${element(var.network_names, count.index)}"
  20. zone = element(var.zones, count.index)
  21. network_id = yandex_vpc_network.vpc-web-app.id
  22. v4_cidr_blocks = [element(var.app_cidrs2, count.index)]
  23. }