threefoldtech / terraform-provider-grid

Apache License 2.0
8 stars 5 forks source link

Integration tests workflow fails #947

Open rawdaGastan opened 3 months ago

rawdaGastan commented 3 months ago

Tests need to be fixed

tests timeout

rawdaGastan commented 3 months ago

Testing

File

terraform {
  required_providers {
    grid = {
      source = "threefoldtech/grid"
    }
  }
}

provider "grid" {
}

locals {
  name = "multinodedeployment"
}

resource "grid_scheduler" "sched" {
  requests {
    name             = "node1"
    cru              = 2
    sru              = 1024 * 2
    mru              = 1024 * 2
    public_ips_count = 2
    public_config    = true
  }
  requests {
    name = "node2"
    cru  = 2
    sru  = 1024 * 10
    mru  = 1024 * 10
  }
}

resource "grid_network" "net1" {
  nodes       = [grid_scheduler.sched.nodes["node1"], grid_scheduler.sched.nodes["node2"]]
  ip_range    = "172.20.0.0/16"
  name        = local.name
  description = "new network"
}

resource "grid_deployment" "d1" {
  name         = local.name
  node         = grid_scheduler.sched.nodes["node1"]
  network_name = grid_network.net1.name
  vms {
    name       = "vm1"
    flist      = "https://hub.grid.tf/tf-official-apps/base:latest.flist"
    cpu        = 2
    memory     = 1024
    publicip   = true
    entrypoint = "/sbin/zinit init"
    env_vars = {
      SSH_KEY = file("~/.ssh/id_rsa.pub")
    }
  }
  vms {
    name       = "vm2"
    flist      = "https://hub.grid.tf/tf-official-apps/base:latest.flist"
    cpu        = 2
    memory     = 1024
    publicip   = true
    entrypoint = "/sbin/zinit init"
    env_vars = {
      SSH_KEY = file("~/.ssh/id_rsa.pub")
    }
  }
}

resource "grid_deployment" "d2" {
  node         = grid_scheduler.sched.nodes["node2"]
  network_name = grid_network.net1.name
  vms {
    name       = "vm3"
    flist      = "https://hub.grid.tf/tf-official-apps/base:latest.flist"
    cpu        = 1
    memory     = 1024
    entrypoint = "/sbin/zinit init"
    env_vars = {
      SSH_KEY = file("~/.ssh/id_rsa.pub")
    }
  }
  vms {
    name       = "vm4"
    flist      = "https://hub.grid.tf/tf-official-apps/base:latest.flist"
    cpu        = 1
    memory     = 1024
    entrypoint = "/sbin/zinit init"
    env_vars = {
      SSH_KEY = file("~/.ssh/id_rsa.pub")
    }
  }
  vms {
    name       = "vm5"
    flist      = "https://hub.grid.tf/tf-official-apps/base:latest.flist"
    cpu        = 1
    memory     = 1024
    entrypoint = "/sbin/zinit init"
    env_vars = {
      SSH_KEY = file("~/.ssh/id_rsa.pub")
    }
  }
  vms {
    name       = "vm6"
    flist      = "https://hub.grid.tf/tf-official-apps/base:latest.flist"
    cpu        = 1
    memory     = 1024
    entrypoint = "/sbin/zinit init"
    env_vars = {
      SSH_KEY = file("~/.ssh/id_rsa.pub")
    }
  }
}

resource "grid_deployment" "d3" {
  node         = grid_scheduler.sched.nodes["node2"]
  network_name = grid_network.net1.name
  vms {
    name       = "vm7"
    flist      = "https://hub.grid.tf/tf-official-apps/base:latest.flist"
    cpu        = 1
    memory     = 1024
    entrypoint = "/sbin/zinit init"
    env_vars = {
      SSH_KEY = file("~/.ssh/id_rsa.pub")
    }
  }
  vms {
    name       = "vm8"
    flist      = "https://hub.grid.tf/tf-official-apps/base:latest.flist"
    cpu        = 1
    memory     = 1024
    entrypoint = "/sbin/zinit init"
    env_vars = {
      SSH_KEY = file("~/.ssh/id_rsa.pub")
    }
  }
  vms {
    name       = "vm9"
    flist      = "https://hub.grid.tf/tf-official-apps/base:latest.flist"
    cpu        = 1
    memory     = 1024
    entrypoint = "/sbin/zinit init"
    env_vars = {
      SSH_KEY = file("~/.ssh/id_rsa.pub")
    }
  }
  vms {
    name       = "vm10"
    flist      = "https://hub.grid.tf/tf-official-apps/base:latest.flist"
    cpu        = 1
    memory     = 1024
    entrypoint = "/sbin/zinit init"
    env_vars = {
      SSH_KEY = file("~/.ssh/id_rsa.pub")
    }
  }
}

output "node1_zmachine1_ip" {
  value = grid_deployment.d1.vms[0].ip
}
output "node1_zmachine_computed_public_ip" {
  value = grid_deployment.d1.vms[0].computedip
}

output "node2_zmachine1_ip" {
  value = grid_deployment.d2.vms[0].ip
}
output "node2_zmachine_computed_public_ip" {
  value = grid_deployment.d2.vms[0].computedip
}

Result

Apply complete! Resources: 5 added, 0 changed, 0 destroyed.

Outputs:

node1_zmachine1_ip = "172.20.2.2"
node1_zmachine_computed_public_ip = "185.206.122.34/24"
node2_zmachine1_ip = "172.20.2.2"
node2_zmachine_computed_public_ip = ""