vpc.tf 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. resource "yandex_vpc_network" "vpc-infra" {
  2. name = "vpc-infra"
  3. }
  4. resource "yandex_vpc_route_table" "rt-inet" {
  5. name = "rt-inet"
  6. network_id = yandex_vpc_network.vpc-infra.id
  7. static_route {
  8. destination_prefix = "0.0.0.0/0"
  9. next_hop_address = "10.0.0.5"
  10. }
  11. }
  12. resource "yandex_vpc_subnet" "public-subnet" {
  13. name = "public-subnet"
  14. zone = "ru-central1-a"
  15. network_id = yandex_vpc_network.vpc-infra.id
  16. v4_cidr_blocks = ["10.0.0.0/24"]
  17. }
  18. resource "yandex_vpc_subnet" "tools-subnet" {
  19. name = "tools-subnet"
  20. zone = "ru-central1-a"
  21. network_id = yandex_vpc_network.vpc-infra.id
  22. v4_cidr_blocks = ["10.50.0.0/24"]
  23. route_table_id = yandex_vpc_route_table.rt-inet.id
  24. }
  25. resource "yandex_vpc_subnet" "subnet-dev" {
  26. name = "subnet-dev"
  27. zone = "ru-central1-a"
  28. network_id = yandex_vpc_network.vpc-infra.id
  29. v4_cidr_blocks = ["10.30.0.0/24"]
  30. folder_id = var.dev_folder_id
  31. }
  32. resource "yandex_vpc_subnet" "subnet-stage" {
  33. name = "subnet-stage"
  34. zone = "ru-central1-a"
  35. network_id = yandex_vpc_network.vpc-infra.id
  36. v4_cidr_blocks = ["10.20.0.0/24"]
  37. route_table_id = yandex_vpc_route_table.rt-inet.id
  38. folder_id = var.stage_folder_id
  39. }
  40. resource "yandex_vpc_subnet" "subnet-prod" {
  41. name = "subnet-prod"
  42. zone = "ru-central1-a"
  43. network_id = yandex_vpc_network.vpc-infra.id
  44. v4_cidr_blocks = ["10.10.0.0/24"]
  45. folder_id = var.prod_folder_id
  46. }