network_tasks.tf 1022 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. resource "yandex_vpc_network" "network-dvwa" {
  2. name = "network1"
  3. }
  4. resource "yandex_vpc_subnet" "dvwa-subnet" {
  5. name = "dvwa-subnet"
  6. zone = "ru-central1-a"
  7. network_id = yandex_vpc_network.network-dvwa.id
  8. v4_cidr_blocks = ["192.168.11.0/24"]
  9. }
  10. resource "yandex_vpc_address" "dvwa-address" {
  11. name = "dvwa-address"
  12. external_ipv4_address {
  13. zone_id = "ru-central1-a"
  14. }
  15. }
  16. resource "yandex_vpc_security_group" "sg-dvwa" {
  17. name = "sg-dvwa"
  18. description = "allows traffic"
  19. network_id = yandex_vpc_network.network-dvwa.id
  20. ingress {
  21. protocol = "TCP"
  22. description = "allow-http"
  23. v4_cidr_blocks = ["0.0.0.0/0"]
  24. port = 80
  25. }
  26. ingress {
  27. protocol = "TCP"
  28. description = "allow-https"
  29. v4_cidr_blocks = ["0.0.0.0/0"]
  30. port = 443
  31. }
  32. egress {
  33. protocol = "ANY"
  34. description = "egress_internet"
  35. v4_cidr_blocks = ["0.0.0.0/0"]
  36. from_port = 0
  37. to_port = 65535
  38. }
  39. }