Skip to content

Commit 31d4236

Browse files
author
Arman Keyoumarsi
committed
Update Documentation
1 parent 218723f commit 31d4236

File tree

2 files changed

+51
-53
lines changed

2 files changed

+51
-53
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Pull requests are the best way to propose changes to the codebase (we use [Githu
1919
1. Fork the repo and create your branch from `master`.
2020
2. If you've added code that should be tested, add tests.
2121
1. This should be done via sanity test section.
22-
2. Attched copy of the passed TF Plan. (Remove sensetive info if necessary)
22+
2. Attach copy of the passed TF Plan. (Remove sensitive info if necessary)
2323
3. If you've changed variables/functionality, update the documentation.
2424
4. Ensure the test suite passes.
2525
5. Make sure your code lints.

README.md

Lines changed: 50 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -20,64 +20,60 @@ This Terraform module deploys single or multiple virtual machines of type (Linux
2020

2121
> 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.
2222
23-
## Usage
23+
## Getting started
2424

2525
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.
2626

2727
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.
2828

29+
__Create a main.tf file and copy the following code. fill the required data and run terraform plan.__
30+
2931
```hcl
32+
33+
# Configure the VMware vSphere Provider
34+
provider "vsphere" {
35+
user = "fill"
36+
password = "fill"
37+
vsphere_server = "fill"
38+
39+
# if you have a self-signed cert
40+
allow_unverified_ssl = true
41+
}
42+
43+
# Deploy 2 linux VMs
3044
module "example-server-linuxvm" {
3145
source = "Terraform-VMWare-Modules/vm/vsphere"
3246
version = "X.X.X"
33-
vmtemp = "TemplateName"
34-
instances = 1
47+
vmtemp = "VM Template Name (Should Alrerady exist)"
48+
instances = 2
3549
vmname = "example-server-linux"
36-
vmrp = "esxi/Resources"
37-
network_cards = ["Name of the Port Group in vSphere"]
38-
ipv4 = {
39-
"Name of the Port Group in vSphere" = ["10.0.0.1"] # To use DHCP create Empty list for each instance
50+
vmrp = "esxi/Resources - or name of a resource pool"
51+
network = {
52+
"Name of the Port Group in vSphere" = ["10.13.113.2", "10.13.113.3"] # To use DHCP create Empty list ["",""]
4053
}
54+
vmgateway = "10.13.113.1"
4155
dc = "Datacenter"
4256
datastore = "Data Store name(use ds_cluster for datastore cluster)"
4357
}
4458
45-
module "example-server-windowsvm" {
46-
source = "Terraform-VMWare-Modules/vm/vsphere"
47-
version = "X.X.X"
48-
vmtemp = "TemplateName"
49-
is_windows_image = true
50-
instances = 1
51-
vmname = "example-server-windows"
52-
vmrp = "esxi/Resources"
53-
network_cards = ["Name of the Port Group in vSphere"]
54-
ipv4 = {
55-
"Name of the Port Group in vSphere" = ["10.0.0.1"] # To use DHCP create Empty list for each instance
56-
}
57-
dc = "Datacenter"
58-
datastore = "Data Store name(use ds_cluster for datastore cluster)"
59-
}
6059
```
6160

62-
> 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.
63-
6461
## Advance Usage
6562

6663
There are number of switches defined in the module, where you can use to enable different features for VM provisioning.
6764

6865
### Main Feature Switches
6966

7067
- You can use `is_windows_image = true` to set the customization type to Windows (By default it is set to Linux customization)
71-
- You can use `data_disk_size_gb = [20,30]` to add additional data disks (Supported in both Linux and Windows deployment)
72-
- Above switch will create two additional disk of capacity 10 and 30gb for the VM.
73-
- You can include `thin_provisioned` switch to define disk type for each additional disk.
7468
- You can use `windomain = "somedomain.com"` to join a windows server to AD domain.
7569
- Requires following additional variables
7670
- `domainuser` Domain account with necessary privileges to join a computer to the domain.
7771
- `domainpass` Domain user password.
7872
- `is_windows_image` needs to be set to `true` to force the module to use Windows customization.
7973

80-
Below is an example of windows deployment with some of the available feature sets.
74+
> 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.
75+
76+
Below is an example of windows deployment with some of the available feature sets. For complete list of available features refer to [variable.tf](https://github.com/Terraform-VMWare-Modules/terraform-vsphere-vm/blob/master/variables.tf)
8177

8278
```hcl
8379
module "example-server-windowsvm-advanced" {
@@ -89,38 +85,35 @@ module "example-server-windowsvm-advanced" {
8985
ds_cluster = "Datastore Cluster" #You can use datastore variable instead
9086
vmtemp = "TemplateName"
9187
instances = 2
92-
cpu_number = 2
93-
ram_size = 2096
94-
cpu_reservation = 2000
95-
memory_reservation = 2000
96-
cpu_hot_add_enabled = true
97-
cpu_hot_remove_enabled = true
98-
memory_hot_add_enabled = true
9988
vmname = "AdvancedVM"
10089
vmdomain = "somedomain.com"
101-
network_cards = ["VM Network", "test-network"] #Assign multiple cards
102-
network_type = ["vmxnet3", "vmxnet3"]
90+
network = {
91+
"Name of the Port Group in vSphere" = ["10.13.113.2", "10.13.113.3"] # To use DHCP create Empty list ["",""]
92+
"Second Network Card" = ["", ""]
93+
}
10394
ipv4submask = ["24", "8"]
104-
ipv4 = { #assign IPs per card
105-
"VM Network" = ["192.168.0.4", ""] // Here the first instance will use Static Ip and Second DHCP
106-
"test" = ["", "192.168.0.3"]
95+
network_type = ["vmxnet3", "vmxnet3"]
96+
tags = {
97+
"terraform-test-category" = "terraform-test-tag"
98+
}
99+
data_disk = {
100+
disk1 = {
101+
size_gb = 30,
102+
thin_provisioned = false,
103+
data_disk_scsi_controller = 0,
104+
},
105+
disk2 = {
106+
size_gb = 70,
107+
thin_provisioned = true,
108+
data_disk_scsi_controller = 1,
109+
datastore_id = "datastore-90679"
110+
}
107111
}
108-
data_disk_size_gb = [10, 5] // Aditional Disk to be used
109-
thin_provisioned = [true, false]
110-
disk_label = ["tpl-disk-1"]
111-
data_disk_label = ["label1", "label2"]
112-
disk_datastore = "vsanDatastore" // This will store Template disk in the defined disk_datastore
113-
data_disk_datastore = ["vsanDatastore", "nfsDatastore"] // Datastores for additional data disks
114112
scsi_bus_sharing = "physicalSharing" // The modes are physicalSharing, virtualSharing, and noSharing
115113
scsi_type = "lsilogic" // Other acceptable value "pvscsi"
116114
scsi_controller = 0 // This will assign OS disk to controller 0
117-
data_disk_scsi_controller = [0, 1] // This will create a new controller and assign second data disk to controller 1
118115
vmdns = ["192.168.0.2", "192.168.0.1"]
119116
vmgateway = "192.168.0.1"
120-
tags = {
121-
"terraform-test-category" = "terraform-test-tag"
122-
"terraform-test-category-02" = "terraform-test-tag-02"
123-
}
124117
enable_disk_uuid = true
125118
auto_logon = true
126119
run_once = ["command01", "command02"] // You can also run Powershell commands
@@ -138,9 +131,14 @@ output "vmnames" {
138131
output "vmnameswip" {
139132
value = "${module.example-server-windowsvm-advanced.Windows-ip}"
140133
}
141-
142134
```
143135

136+
## Contributing
137+
138+
This module is the work of many contributors. We appreciate your help!
139+
140+
To contribute, please read the [contribution guidelines](https://github.com/Terraform-VMWare-Modules/terraform-vsphere-vm/blob/master/CONTRIBUTING.md)
141+
144142
## Authors
145143

146144
Originally created by [Arman Keyoumarsi](https://github.com/Arman-Keyoumarsi)

0 commit comments

Comments
 (0)