Skip to content

Commit

Permalink
Merge pull request #85 from Terraform-VMWare-Modules/rc/3.0.0
Browse files Browse the repository at this point in the history
Rc/3.0.0
  • Loading branch information
Arman-Keyoumarsi authored Apr 23, 2021
2 parents 3f068f6 + c978955 commit 150511b
Show file tree
Hide file tree
Showing 11 changed files with 139 additions and 298 deletions.
84 changes: 0 additions & 84 deletions CHANGELOG.md

This file was deleted.

7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Terraform vSphere Module

![Terraform Version](https://img.shields.io/badge/Terraform-0.13.5-green.svg) [![TF Registry](https://img.shields.io/badge/terraform-registry-blue.svg)](https://registry.terraform.io/modules/Terraform-VMWare-Modules/vm/vsphere/) [![Changelog](https://img.shields.io/badge/changelog-release-green.svg)](https://github.com/Terraform-VMWare-Modules/terraform-vsphere-vm/releases) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
![Terraform Version](https://img.shields.io/badge/Terraform-0.14-green.svg) [![TF Registry](https://img.shields.io/badge/terraform-registry-blue.svg)](https://registry.terraform.io/modules/Terraform-VMWare-Modules/vm/vsphere/) [![Changelog](https://img.shields.io/badge/changelog-release-green.svg)](https://github.com/Terraform-VMWare-Modules/terraform-vsphere-vm/releases) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

For Virtual Machine Provisioning with (Linux/Windows) customization. Based on Terraform v0.13, this module include most of the advance features that are available in the resource `vsphere_virtual_machine`.
For Virtual Machine Provisioning with (Linux/Windows) customization. Based on Terraform v0.13 and up, this module include most of the advance features that are available in resource `vsphere_virtual_machine`.

## Deploys (Single/Multiple) Virtual Machines to your vSphere environment

This Terraform module deploys single or multiple virtual machines of type (Linux/Windows) with following features:

- Ability to specify Linux or Windows VM customization.
- Ability to add multiple network cards for the VM
- Ability to add multiple network cards for the VM
- Ability to assign tags and custom variables.
- Ability to configure advance features for the vm.
- Ability to deploy either a datastore or a datastore cluster.
Expand Down Expand Up @@ -85,6 +85,7 @@ module "example-server-windowsvm-advanced" {
vmtemp = "TemplateName"
instances = 2
vmname = "AdvancedVM"
vmnameformat = "%03d" #To use three decimal with leading zero vmnames will be AdvancedVM001,AdvancedVM002
vmdomain = "somedomain.com"
network = {
"Name of the Port Group in vSphere" = ["10.13.113.2", "10.13.113.3"] # To use DHCP create Empty list ["",""]
Expand Down
6 changes: 6 additions & 0 deletions examples/example-Windows-data_disk.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
data "vsphere_storage_policy" "policy" {
name = "policy1"
}

module "example-server-windowsvm-advanced" {
source = "Terraform-VMWare-Modules/vm/vsphere"
version = "X.X.X"
Expand All @@ -12,11 +16,13 @@ module "example-server-windowsvm-advanced" {
network = {
"Name of the Port Group in vSphere" = ["10.13.113.2", "10.13.113.3"] # To use DHCP create Empty list ["",""]
}
template_storage_policy_id = [data.vsphere_storage_policy.this.id] #Policy ID for the template disks
data_disk = {
disk1 = {
size_gb = 30,
thin_provisioned = false,
data_disk_scsi_controller = 0,
storage_policy_id = "ff45cc66-b624-4621-967f-1aef6437f568" #Different policy ID for data disks
},
disk2 = {
size_gb = 70,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,16 @@ module "example-server-linuxvm-advanced" {
datastore_cluster = "Datastore Cluster"
vmtemp = "TemplateName"
instances = 2
cpu_number = 2
ram_size = 2096
cpu_hot_add_enabled = true
cpu_hot_remove_enabled = true
memory_hot_add_enabled = true
vmname = "AdvancedVM"
vmdomain = "somedomain.com"
ipv4submask = ["24", "8"]
network = {
"Network01" = ["10.13.113.2", "10.13.113.3"] # To use DHCP create Empty list ["",""]
"Network02" = ["", ""] #Second Network will use the DHCP
}
disk_label = ["tpl-disk-1"]
data_disk_label = ["label1", "label2"]
scsi_type = "lsilogic" # "pvscsi"
disk_datastore = "vsanDatastore"
vmdns = ["192.168.0.2", "192.168.0.1"]
vmgateway = "192.168.0.1"
network_type = ["vmxnet3", "vmxnet3"]
tags = {
"terraform-test-category-01" = "terraform-test-tag-01"
"terraform-test-category-02" = "terraform-test-tag-02"
}
}

22 changes: 6 additions & 16 deletions examples/example-linux-depend_on.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ module "example-server-linuxvm" {
instances = 1
vmname = "example-server-windows"
vmrp = "esxi/Resources"
network_cards = ["Name of the Port Group in vSphere"]
ipv4 = {
"Name of the Port Group in vSphere" = ["10.0.0.1"] # To use DHCP create empty string for each instance
network = {
"Network01" = ["10.13.113.2", "10.13.113.3"] # To use DHCP create Empty list ["",""]
"Network02" = ["", ""] #Second Network will use the DHCP
}
dc = "Datacenter"
datastore = "Data Store name(use datastore_cluster for datastore cluster)"
Expand All @@ -31,21 +31,11 @@ module "example-server-linuxvm-advanced" {
memory_hot_add_enabled = true
vmname = "AdvancedVM"
vmdomain = "somedomain.com"
network_cards = ["VM Network", "test-network"]
ipv4submask = ["24", "8"]
ipv4 = {
"VM Network" = ["192.168.0.4", ""] // Here the first instance will use Static Ip and Second set to DHCP
"test" = ["", "192.168.0.3"]
network = {
"Network01" = ["10.13.113.2", "10.13.113.3"] # To use DHCP create Empty list ["",""]
"Network02" = ["", ""] #Second Network will use the DHCP
}
disk_label = ["tpl-disk-1"]
data_disk_label = ["label1", "label2"]
scsi_type = "lsilogic" # "pvscsi"
scsi_controller = 0
data_disk_scsi_controller = [0, 1]
disk_datastore = "vsanDatastore"
data_disk_datastore = ["vsanDatastore", "nfsDatastore"]
data_disk_size_gb = [10, 5] // Aditional Disks to be used
thin_provisioned = [true, false]
vmdns = ["192.168.0.2", "192.168.0.1"]
vmgateway = "192.168.0.1"
network_type = ["vmxnet3", "vmxnet3"]
Expand Down
38 changes: 38 additions & 0 deletions examples/example-vmname.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Single VM deployment with literal name
module "example-server-single" {
source = "Terraform-VMWare-Modules/vm/vsphere"
version = "Latest X.X.X"
vmtemp = "TemplateName"
instances = 1
vmname = "liternalvmname"
vmrp = "esxi/Resources"
network = {
"Name of the Port Group in vSphere" = ["10.13.113.2"]
}
dc = "Datacenter"
datastore = "Data Store name(use datastore_cluster for datastore cluster)"
}

# Vmname Output -> liternalvmname

// Example of multiple VM deployment with complex naming standard
# Define Environment Variable to switch between Environments
variable "env" {
default = "dev"
}
module "example-server-multi" {
source = "Terraform-VMWare-Modules/vm/vsphere"
version = "Latest X.X.X"
vmtemp = "TemplateName"
instances = 2
vmname = "advancevm"
vmnameformat = "%03d${var.env}"
vmrp = "esxi/Resources"
network = {
"Name of the Port Group in vSphere" = ["10.13.113.2", ""]
}
dc = "Datacenter"
datastore = "Data Store name(use datastore_cluster for datastore cluster)"
}

# Vmname Output -> advancevm001dev, advancevm002dev
Loading

0 comments on commit 150511b

Please sign in to comment.