You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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`.
5
+
For Virtual Machine Provisioning with (Linux/Windows) customization. Based on Terraform v0.13 and up, this module includes most of the advanced features available in resource `vsphere_virtual_machine`.
6
6
7
7
## Deploys (Single/Multiple) Virtual Machines to your vSphere environment
8
8
9
-
This Terraform module deploys single or multiple virtual machines of type (Linux/Windows) with following features:
9
+
This Terraform module deploys single or multiple virtual machines of type (Linux/Windows) with the following features:
10
10
11
11
- Ability to specify Linux or Windows VM customization.
12
12
- Ability to add multiple network cards for the VM
13
13
- Ability to assign tags and custom variables.
14
-
- Ability to configure advance features for the vm.
14
+
- Ability to configure advanced features for a VM.
15
15
- Ability to deploy either a datastore or a datastore cluster.
16
16
- Add extra data disk (up to 15) to the VM.
17
17
- Different datastores for data disks (datastore_id).
18
-
- Different storage policy for data disks (storage_policy_id).
18
+
- Different storage policies for data disks (storage_policy_id).
19
19
- Different scsi_controllers per disk, including data disks.
20
20
- Ability to define depend on using variable vm_depends_on & tag_depends_on
21
21
22
-
> Note: For module to work it needs number of required variables corresponding to an existing resources in vSphere. Please refer to variable section for the list of required variables.
22
+
> Note: For the module to work, it needs several required variables corresponding to existing resources in vSphere. Please refer to the variable section for the list of required variables.
23
23
24
24
## Getting started
25
25
26
-
Following example contains the bare minimum options to be configured for (Linux/Windows) VM deployment. You can choose between windows and linux customization by simply using the ´is_windows_image´ boolean switch.
26
+
The following example contains the bare minimum options to be configured for (Linux/Windows) VM deployment. You can choose between Windows and Linux customization by simply using the `is_windows_image` boolean switch.
27
27
28
-
You can also download the entire module and use your own predefined variables to map your entire vSphere environment and use it within this module.
28
+
You can also download the entire module and use your predefined variables to map your entire vSphere environment and use it within this module.
29
29
30
-
__Create a main.tf file and copy the following code. fill the required data and run terraform plan.__
30
+
First, create a `main.tf` file.
31
31
32
-
```hcl
32
+
Next, copy the code below and fill in the required variables.
33
33
34
+
```hcl
34
35
# Configure the VMware vSphere Provider
35
36
provider "vsphere" {
36
37
user = "fill"
37
38
password = "fill"
38
-
vsphere_server = "fill"
39
+
vsphere_server = "fill"
39
40
40
41
# if you have a self-signed cert
41
42
allow_unverified_ssl = true
42
43
}
43
44
44
45
# Deploy 2 linux VMs
45
46
module "example-server-linuxvm" {
46
-
source = "Terraform-VMWare-Modules/vm/vsphere"
47
-
version = "X.X.X"
48
-
vmtemp = "VM Template Name (Should Alrerady exist)"
49
-
instances = 2
50
-
vmname = "example-server-linux"
51
-
vmrp = "esxi/Resources - or name of a resource pool"
47
+
source = "Terraform-VMWare-Modules/vm/vsphere"
48
+
version = "X.X.X"
49
+
vmtemp = "VM Template Name (Should Alrerady exist)"
50
+
instances = 2
51
+
vmname = "example-server-linux"
52
+
vmrp = "esxi/Resources - or name of a resource pool"
52
53
network = {
53
54
"Name of the Port Group in vSphere" = ["10.13.113.2", "10.13.113.3"] # To use DHCP create Empty list ["",""]
54
55
}
55
-
vmgateway = "10.13.113.1"
56
+
vmgateway = "10.13.113.1"
56
57
dc = "Datacenter"
57
58
datastore = "Data Store name(use datastore_cluster for datastore cluster)"
58
59
}
60
+
```
61
+
62
+
Finally, run
59
63
64
+
```bash
65
+
terraform run
60
66
```
61
67
62
-
## Advance Usage
68
+
## Advanced Usage
63
69
64
-
There are number of switches defined in the module, where you can use to enable different features for VM provisioning.
70
+
The module includes several option switches, which you can use to enable various VM provisioning features.
65
71
66
-
- You can use `is_windows_image = true` to set the customization type to Windows (By default it is set to Linux customization)
67
-
- You can use `windomain = "somedomain.com"` to join a windows server to AD domain.
72
+
- You can use `is_windows_image = true` to set the customization type to Windows (By default, it is Linux customization)
73
+
- You can use `windomain = "somedomain.com"` to join a Windows server to an AD domain.
68
74
- Requires following additional variables
69
-
-`domainuser` Domain account with necessary privileges to join a computer to the domain.
70
-
-`domainpass` Domain user password.
75
+
-`domainuser`- Domain account with necessary privileges to join a computer to the domain.
76
+
-`domainpass`- Domain user password.
71
77
-`is_windows_image` needs to be set to `true` to force the module to use Windows customization.
72
78
73
-
> Note: When deploying a windows server in WorkGroup, we recommend to keep the Local Admin password set to its default and change it later via an script. Unfortunately Terraform redeploy the entire server if you change the local admin password within your code.
79
+
> Note: When deploying a windows server in WorkGroup, we recommend keeping the Local Admin password set to its default and change it later via a script. Unfortunately, Terraform will re-deploy the entire server if you change the local admin password.
74
80
75
-
Below is an example of windows deployment with some of the available feature sets. For complete list of available features please refer to [variable.tf](https://github.com/Terraform-VMWare-Modules/terraform-vsphere-vm/blob/master/variables.tf)
81
+
Below is an example of windows deployment with some of the available feature sets. For a complete list of available features, please refer to [variable.tf](https://github.com/Terraform-VMWare-Modules/terraform-vsphere-vm/blob/master/variables.tf)
76
82
77
83
```hcl
78
84
module "example-server-windowsvm-advanced" {
79
-
source = "Terraform-VMWare-Modules/vm/vsphere"
80
-
version = "X.X.X"
81
-
dc = "Datacenter"
82
-
vmrp = "cluster/Resources" #Works with ESXi/Resources
83
-
vmfolder = "Cattle"
84
-
datastore_cluster = "Datastore Cluster" #You can use datastore variable instead
85
-
vmtemp = "TemplateName"
86
-
instances = 2
87
-
vmname = "AdvancedVM"
88
-
vmnameformat = "%03d" #To use three decimal with leading zero vmnames will be AdvancedVM001,AdvancedVM002
89
-
domain = "somedomain.com"
85
+
source = "Terraform-VMWare-Modules/vm/vsphere"
86
+
version = "X.X.X"
87
+
dc = "Datacenter"
88
+
vmrp = "cluster/Resources" #Works with ESXi/Resources
89
+
vmfolder = "Cattle"
90
+
datastore_cluster = "Datastore Cluster" #You can use datastore variable instead
91
+
vmtemp = "TemplateName"
92
+
instances = 2
93
+
vmname = "AdvancedVM"
94
+
vmnameformat = "%03d" #To use three decimal with leading zero vmnames will be AdvancedVM001,AdvancedVM002
95
+
domain = "somedomain.com"
90
96
network = {
91
97
"Name of the Port Group in vSphere" = ["10.13.113.2", "10.13.113.3"] # To use DHCP create Empty list ["",""]
0 commit comments