Skip to content
main.tf 1.03 KiB
Newer Older
Michael Kennedy's avatar
Michael Kennedy committed
# =================== #
# Deploying VMware VM #
# =================== #
terraform {
  required_providers {
    vsphere = {
Michael Kennedy's avatar
Michael Kennedy committed
      source  = "hashicorp/vsphere"
Michael Kennedy's avatar
Michael Kennedy committed
    }
  }
}

provider "vsphere" {
  vim_keep_alive = 30
  user           = var.vsphere_connection.user
  password       = var.vsphere_connection.password
  vsphere_server = var.vsphere_connection
Michael Kennedy's avatar
Michael Kennedy committed
}

# Master VM
module "vsphere_vm_master" {
Michael Kennedy's avatar
Michael Kennedy committed
  count              = var.master_nodes
  source             = "../tf-vmware-ubuntu"
  vm_guest_config    = var.vm_guest_config
  vm_template        = var.vm_template
  vsphere_connection = var.vsphere_connection
  master_nodes       = var.master_nodes
  worker_nodes       = var.worker_nodes
Michael Kennedy's avatar
Michael Kennedy committed
}

# Worker VM
module "vsphere_vm_worker" {
Michael Kennedy's avatar
Michael Kennedy committed
  for_each           = var.worker_nodes
  source             = "../tf-vmware-ubuntu"
  vm_guest_config    = var.vm_guest_config
  vm_template        = var.vm_template
  vsphere_connection = var.vsphere_connection
  master_nodes       = var.master_nodes
  worker_nodes       = var.worker_nodes
Michael Kennedy's avatar
Michael Kennedy committed
}