variable "user" {}
variable "password" {}

# Terraform backends cannot contain interpolations
terraform {
  backend "s3" {
    bucket  = "orcd-terraform-state"
    key     = "prod/accounting-outfile/maxwells/terraform.tfstate"
    region  = "us-east-1"
    encrypt = "true"
  }
}

provider "vsphere" {
  user           = "${var.user}"
  password       = "${var.password}"
  vsphere_server = "vsphere02.avl.theorchard"

  # If you have a self-signed cert
  allow_unverified_ssl = true
}

module "vmware_vms" {
  source = "git@github.com:theorchard/terraform-vmware.git//?ref=1.1.0"

  vsphere_user     = var.user # use this syntax, username@domain.com and NOT domain\username when prompt.
  vsphere_password = var.password
  vsphere_server   = "vsphere02.avl.theorchard"

  vm_hostnames = [
    "prod-accounting-nfs01"
  ]
  vm_domain = "avl.theorchard"

  vsphere_datacenter_name      = "AVL-Datacenter01"
  vsphere_datastore_name       = "nimble02-vol08"
  vsphere_compute_cluster_name = "AVL-Cluster01"
  vsphere_network_name         = "VM Network"
  vm_num_cpus                  = "2"
  vm_memory                    = "4096"
  chef_client_version          = "15.5.15"
}

resource "vsphere_virtual_disk" "accounting_outfile_disk" {
  size       = 450
  vmdk_path  = "accounting_outfile_disk.vmdk"
  datacenter = "AVL-Datacenter01"
  datastore  = "nimble02-vol08"
  type       = "eagerZeroedThick"
}
