route-switcher.tf 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. module "route_switcher_infra" {
  2. source = "./modules/multi-vpc-infra/"
  3. folder_id = yandex_resourcemanager_folder.folder4.id
  4. # usually a management subnet. used for healthkeaking status of the appliance
  5. first_router_subnet = yandex_vpc_subnet.subnet-a_vpc_4.id # !!заменить здесь на mgmt
  6. first_router_address = "${cidrhost(var.subnet-a_vpc_4, 10)}"
  7. second_router_subnet = yandex_vpc_subnet.subnet-b_vpc_4.id
  8. second_router_address = "${cidrhost(var.subnet-b_vpc_4, 10)}"
  9. }
  10. module "network_a_protected" {
  11. source = "./modules/multi-vpc-protected-network/"
  12. #values below should be used the same in different protected networks
  13. sa_id = module.route_switcher_infra.sa_id
  14. load_balancer_id = module.route_switcher_infra.load_balancer_id
  15. target_group_id = module.route_switcher_infra.target_group_id
  16. bucket_id = module.route_switcher_infra.bucket_id
  17. access_key = module.route_switcher_infra.access_key
  18. secret_key = module.route_switcher_infra.secret_key
  19. first_router_address = module.route_switcher_infra.first_router_address
  20. second_router_address = module.route_switcher_infra.second_router_address
  21. #values below will change in different folders if network are located in different folders
  22. folder_id = yandex_resourcemanager_folder.folder1.id
  23. #values below will change in different networks
  24. vpc_id = yandex_vpc_network.vpc_name_1.id
  25. # first_az_rt is usually an active rt in first az , but back become backup if second_az appliace fails
  26. first_az_rt = yandex_vpc_route_table.servers.id
  27. first_az_subnet_list = [yandex_vpc_subnet.subnet-a_vpc_1.id]
  28. # second_az_rt is usually an active rt in second az , but back become backup if first_az appliace fails
  29. second_az_rt = yandex_vpc_route_table.servers-backup.id
  30. second_az_subnet_list = [yandex_vpc_subnet.subnet-b_vpc_1.id]
  31. }
  32. module "network_b_protected" {
  33. #values below will change in different networks
  34. source = "./modules//multi-vpc-protected-network/"
  35. #values below should be used the same in different protected networks
  36. sa_id = module.route_switcher_infra.sa_id
  37. load_balancer_id = module.route_switcher_infra.load_balancer_id
  38. target_group_id = module.route_switcher_infra.target_group_id
  39. bucket_id = module.route_switcher_infra.bucket_id
  40. access_key = module.route_switcher_infra.access_key
  41. secret_key = module.route_switcher_infra.secret_key
  42. first_router_address = module.route_switcher_infra.first_router_address
  43. second_router_address = module.route_switcher_infra.second_router_address
  44. #values below will change in different folders if network are located in different folders
  45. folder_id = yandex_resourcemanager_folder.folder2.id
  46. #values below will change in different networks
  47. vpc_id = yandex_vpc_network.vpc_name_2.id
  48. # first_az_rt is usually an active rt in first az , but back become backup if second_az appliace fails
  49. first_az_rt = yandex_vpc_route_table.database.id
  50. first_az_subnet_list = [yandex_vpc_subnet.subnet-a_vpc_2.id]
  51. # second_az_rt is usually an active rt in second az , but back become backup if first_az appliace fails
  52. second_az_rt = yandex_vpc_route_table.database-backup.id
  53. second_az_subnet_list = [yandex_vpc_subnet.subnet-b_vpc_2.id]
  54. }