vm_tasks.tf 744 B

123456789101112131415161718192021222324252627
  1. data "yandex_compute_image" "container-optimized-image" {
  2. family = "container-optimized-image"
  3. }
  4. resource "yandex_compute_instance" "instance-based-on-coi" {
  5. name = "dvwa"
  6. zone = "ru-central1-a"
  7. boot_disk {
  8. initialize_params {
  9. image_id = data.yandex_compute_image.container-optimized-image.id
  10. }
  11. }
  12. network_interface {
  13. subnet_id = yandex_vpc_subnet.dvwa-subnet.id
  14. nat = true
  15. nat_ip_address = yandex_vpc_address.dvwa-address.external_ipv4_address.0.address
  16. security_group_ids = [yandex_vpc_security_group.sg-dvwa.id]
  17. }
  18. resources {
  19. cores = 2
  20. memory = 4
  21. }
  22. metadata = {
  23. docker-container-declaration = file("declaration.yaml")
  24. user-data = file("cloud_config.yaml")
  25. }
  26. }