Skip to content

Commit 150511b

Browse files
Merge pull request #85 from Terraform-VMWare-Modules/rc/3.0.0
Rc/3.0.0
2 parents 3f068f6 + c978955 commit 150511b

File tree

11 files changed

+139
-298
lines changed

11 files changed

+139
-298
lines changed

CHANGELOG.md

Lines changed: 0 additions & 84 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Terraform vSphere Module
22

3-
![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)
3+
![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)
44

5-
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`.
5+
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`.
66

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

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

1111
- Ability to specify Linux or Windows VM customization.
12-
- Ability to add multiple network cards for the VM
12+
- Ability to add multiple network cards for the VM
1313
- Ability to assign tags and custom variables.
1414
- Ability to configure advance features for the vm.
1515
- Ability to deploy either a datastore or a datastore cluster.
@@ -85,6 +85,7 @@ module "example-server-windowsvm-advanced" {
8585
vmtemp = "TemplateName"
8686
instances = 2
8787
vmname = "AdvancedVM"
88+
vmnameformat = "%03d" #To use three decimal with leading zero vmnames will be AdvancedVM001,AdvancedVM002
8889
vmdomain = "somedomain.com"
8990
network = {
9091
"Name of the Port Group in vSphere" = ["10.13.113.2", "10.13.113.3"] # To use DHCP create Empty list ["",""]

examples/example-Windows-data_disk.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
data "vsphere_storage_policy" "policy" {
2+
name = "policy1"
3+
}
4+
15
module "example-server-windowsvm-advanced" {
26
source = "Terraform-VMWare-Modules/vm/vsphere"
37
version = "X.X.X"
@@ -12,11 +16,13 @@ module "example-server-windowsvm-advanced" {
1216
network = {
1317
"Name of the Port Group in vSphere" = ["10.13.113.2", "10.13.113.3"] # To use DHCP create Empty list ["",""]
1418
}
19+
template_storage_policy_id = [data.vsphere_storage_policy.this.id] #Policy ID for the template disks
1520
data_disk = {
1621
disk1 = {
1722
size_gb = 30,
1823
thin_provisioned = false,
1924
data_disk_scsi_controller = 0,
25+
storage_policy_id = "ff45cc66-b624-4621-967f-1aef6437f568" #Different policy ID for data disks
2026
},
2127
disk2 = {
2228
size_gb = 70,

examples/example-linux-Netwrok.tf renamed to examples/example-linux-Network.tf

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,16 @@ module "example-server-linuxvm-advanced" {
88
datastore_cluster = "Datastore Cluster"
99
vmtemp = "TemplateName"
1010
instances = 2
11-
cpu_number = 2
12-
ram_size = 2096
13-
cpu_hot_add_enabled = true
14-
cpu_hot_remove_enabled = true
15-
memory_hot_add_enabled = true
1611
vmname = "AdvancedVM"
1712
vmdomain = "somedomain.com"
1813
ipv4submask = ["24", "8"]
1914
network = {
2015
"Network01" = ["10.13.113.2", "10.13.113.3"] # To use DHCP create Empty list ["",""]
2116
"Network02" = ["", ""] #Second Network will use the DHCP
2217
}
23-
disk_label = ["tpl-disk-1"]
24-
data_disk_label = ["label1", "label2"]
25-
scsi_type = "lsilogic" # "pvscsi"
2618
disk_datastore = "vsanDatastore"
2719
vmdns = ["192.168.0.2", "192.168.0.1"]
2820
vmgateway = "192.168.0.1"
2921
network_type = ["vmxnet3", "vmxnet3"]
30-
tags = {
31-
"terraform-test-category-01" = "terraform-test-tag-01"
32-
"terraform-test-category-02" = "terraform-test-tag-02"
33-
}
3422
}
3523

examples/example-linux-depend_on.tf

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ module "example-server-linuxvm" {
66
instances = 1
77
vmname = "example-server-windows"
88
vmrp = "esxi/Resources"
9-
network_cards = ["Name of the Port Group in vSphere"]
10-
ipv4 = {
11-
"Name of the Port Group in vSphere" = ["10.0.0.1"] # To use DHCP create empty string for each instance
9+
network = {
10+
"Network01" = ["10.13.113.2", "10.13.113.3"] # To use DHCP create Empty list ["",""]
11+
"Network02" = ["", ""] #Second Network will use the DHCP
1212
}
1313
dc = "Datacenter"
1414
datastore = "Data Store name(use datastore_cluster for datastore cluster)"
@@ -31,21 +31,11 @@ module "example-server-linuxvm-advanced" {
3131
memory_hot_add_enabled = true
3232
vmname = "AdvancedVM"
3333
vmdomain = "somedomain.com"
34-
network_cards = ["VM Network", "test-network"]
3534
ipv4submask = ["24", "8"]
36-
ipv4 = {
37-
"VM Network" = ["192.168.0.4", ""] // Here the first instance will use Static Ip and Second set to DHCP
38-
"test" = ["", "192.168.0.3"]
35+
network = {
36+
"Network01" = ["10.13.113.2", "10.13.113.3"] # To use DHCP create Empty list ["",""]
37+
"Network02" = ["", ""] #Second Network will use the DHCP
3938
}
40-
disk_label = ["tpl-disk-1"]
41-
data_disk_label = ["label1", "label2"]
42-
scsi_type = "lsilogic" # "pvscsi"
43-
scsi_controller = 0
44-
data_disk_scsi_controller = [0, 1]
45-
disk_datastore = "vsanDatastore"
46-
data_disk_datastore = ["vsanDatastore", "nfsDatastore"]
47-
data_disk_size_gb = [10, 5] // Aditional Disks to be used
48-
thin_provisioned = [true, false]
4939
vmdns = ["192.168.0.2", "192.168.0.1"]
5040
vmgateway = "192.168.0.1"
5141
network_type = ["vmxnet3", "vmxnet3"]

examples/example-vmname.tf

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Single VM deployment with literal name
2+
module "example-server-single" {
3+
source = "Terraform-VMWare-Modules/vm/vsphere"
4+
version = "Latest X.X.X"
5+
vmtemp = "TemplateName"
6+
instances = 1
7+
vmname = "liternalvmname"
8+
vmrp = "esxi/Resources"
9+
network = {
10+
"Name of the Port Group in vSphere" = ["10.13.113.2"]
11+
}
12+
dc = "Datacenter"
13+
datastore = "Data Store name(use datastore_cluster for datastore cluster)"
14+
}
15+
16+
# Vmname Output -> liternalvmname
17+
18+
// Example of multiple VM deployment with complex naming standard
19+
# Define Environment Variable to switch between Environments
20+
variable "env" {
21+
default = "dev"
22+
}
23+
module "example-server-multi" {
24+
source = "Terraform-VMWare-Modules/vm/vsphere"
25+
version = "Latest X.X.X"
26+
vmtemp = "TemplateName"
27+
instances = 2
28+
vmname = "advancevm"
29+
vmnameformat = "%03d${var.env}"
30+
vmrp = "esxi/Resources"
31+
network = {
32+
"Name of the Port Group in vSphere" = ["10.13.113.2", ""]
33+
}
34+
dc = "Datacenter"
35+
datastore = "Data Store name(use datastore_cluster for datastore cluster)"
36+
}
37+
38+
# Vmname Output -> advancevm001dev, advancevm002dev

0 commit comments

Comments
 (0)