Skip to content
Snippets Groups Projects
main.tf 740 B
Newer Older
# is created in internal-network module and called in root module
variable "internal_subnet_id" {type = string}

Ryan Randles Jones's avatar
Ryan Randles Jones committed
variable "image_compute" {}
variable "flavor" {}

# is created in key-pair module and called in root module
variable "key_pair" {type = "string"}

Ryan Randles Jones's avatar
Ryan Randles Jones committed
variable "compute_node_count" { }
Ryan Randles Jones's avatar
Ryan Randles Jones committed
variable "internal_net" {}
Ryan Randles Jones's avatar
Ryan Randles Jones committed

# creates compute node
resource "openstack_compute_instance_v2" "c0" {
  depends_on      = [var.internal_subnet_id]
  name            = "c${count.index}"
  image_name      = var.image_compute
  flavor_name     = var.flavor
Ryan Randles Jones's avatar
Ryan Randles Jones committed
  key_pair        = var.key_pair
Ryan Randles Jones's avatar
Ryan Randles Jones committed
  security_groups = ["default"]
  count           = var.compute_node_count

# defines the networks of the instance
  network {
    name = var.internal_net
  }
}