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
description = "Define PortGroup and IPs for each VM"
8
+
type = map(list(string))
9
+
default = {}
10
+
}
11
+
variable "data_disk" {
12
+
description = "Storage data disk parameter, example"
13
+
type = map(map(string))
14
+
default = {}
15
+
}
16
+
```
17
+
__Removed varsiables__
18
+
19
+
```hcl
20
+
#Network Section
21
+
variable "network_cards" {
22
+
description = ""
23
+
type = list(string)
24
+
default = null
25
+
}
26
+
27
+
variable "ipv4" {
28
+
description = "host(VM) IP address in map format, support more than one IP. Should correspond to number of instances."
29
+
type = map
30
+
default = {}
31
+
}
32
+
33
+
#Data Disk Section
34
+
data "vsphere_datastore" "data_disk_datastore" {
35
+
for_each = toset(var.data_disk_datastore)
36
+
name = each.key
37
+
datacenter_id = data.vsphere_datacenter.dc.id
38
+
}
39
+
40
+
41
+
variable "data_disk_label" {
42
+
description = "Storage data disk labels."
43
+
type = list
44
+
default = []
45
+
}
46
+
47
+
variable "data_disk_size_gb" {
48
+
description = "List of Storage data disk size."
49
+
type = list
50
+
default = []
51
+
}
52
+
53
+
variable "thin_provisioned" {
54
+
description = "If true, this disk is thin provisioned, with space for the file being allocated on an as-needed basis."
55
+
type = list
56
+
default = null
57
+
}
58
+
59
+
variable "eagerly_scrub" {
60
+
description = "if set to true, the disk space is zeroed out on VM creation. This will delay the creation of the disk or virtual machine. Cannot be set to true when thin_provisioned is true."
61
+
type = list
62
+
default = null
63
+
}
64
+
65
+
variable "data_disk_datastore" {
66
+
description = "Define where the data disk should be stored, should be equal to number of defined data disks."
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+6-11Lines changed: 6 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ We love your input! We want to make contributing to this project as easy and tra
7
7
- Proposing new features
8
8
- Becoming a maintainer
9
9
10
-
## We Do have Dedicated Slack Channel
10
+
## We Do have a Dedicated Slack Channel
11
11
You can join the channel using the following [link](https://join.slack.com/t/terraformvmware/shared_invite/zt-elw5yhds-kPT_QMBWaHGLCPkPJKxYeA).
12
12
13
13
## We Develop with Github
@@ -18,37 +18,32 @@ Pull requests are the best way to propose changes to the codebase (we use [Githu
18
18
19
19
1. Fork the repo and create your branch from `master`.
20
20
2. If you've added code that should be tested, add tests.
21
-
3. If you've changed APIs, update the documentation.
21
+
1. This should be done via sanity test section.
22
+
2. Attach copy of the passed TF Plan. (Remove sensitive info if necessary)
23
+
3. If you've changed variables/functionality, update the documentation.
22
24
4. Ensure the test suite passes.
23
25
5. Make sure your code lints.
24
26
6. Issue that pull request!
25
27
26
28
## Any contributions you make will be under the MIT Software License
27
29
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern.
28
30
29
-
## Report bugs using Github's [issues](https://github.com/briandk/transcriptase-atom/issues)
31
+
## Report bugs using Github's [issues](https://github.com/Terraform-VMWare-Modules/terraform-vsphere-vm/issues)
30
32
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](); it's that easy!
31
33
32
34
## Write bug reports with detail, background, and sample code
33
-
[This is an example](http://stackoverflow.com/q/12488905/180626) of a bug report I wrote, and I think it's not a bad model. Here's [another example from Craig Hockenberry](http://www.openradar.me/11905408), an app developer whom I greatly respect.
34
35
35
36
**Great Bug Reports** tend to have:
36
37
37
38
- A quick summary and/or background
38
39
- Steps to reproduce
39
40
- Be specific!
40
-
- Give sample code if you can.[My stackoverflow question](http://stackoverflow.com/q/12488905/180626) includes sample code that *anyone* with a base R setup can run to reproduce what I was seeing
41
+
- Give sample code if you can.
41
42
- What you expected would happen
42
43
- What actually happens
43
44
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
44
45
45
46
People *love* thorough bug reports. I'm not even kidding.
46
47
47
-
## Use a Consistent Coding Style
48
-
I'm again borrowing these from [Facebook's Guidelines](https://github.com/facebook/draft-js/blob/a9316a723f9e918afde44dea68b5f9f39b7d9b00/CONTRIBUTING.md)
49
-
50
-
* 2 spaces for indentation rather than tabs
51
-
* You can try running `npm run lint` for style unification
52
-
53
48
## License
54
49
By contributing, you agree that your contributions will be licensed under its MIT License.
For Virtual Machine Provisioning with (Linux/Windows) customization. Thanks to the new enhancements introduced in Terraform v0.12.6 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, this module include most of the advance features that are available in the resource `vsphere_virtual_machine`.
6
6
7
7
## Deploys (Single/Multiple) Virtual Machines to your vSphere environment
8
8
9
9
This Terraform module deploys single or multiple virtual machines of type (Linux/Windows) with following features:
10
10
11
11
- Ability to specify Linux or Windows VM customization.
12
-
- Ability to add extra data disk (up to 15) to the VM.
13
-
- Ability to deploy Multiple instances.
14
-
- Ability to set IP and Gateway configuration for the VM.
15
-
- Ability to add multiple network cards for the VM
16
-
- Ability to choose vSphere resource pool or fall back to Cluster/ESXi root resource pool.
17
-
- Ability to deploy Windows images to WorkGroup or Domain.
18
-
- Ability to output VM names and IPs per module.
19
-
- Ability assign tags and custom variables.
12
+
- Ability to add multiple network cards for the VM
13
+
- Ability to assign tags and custom variables.
20
14
- Ability to configure advance features for the vm.
21
15
- Ability to deploy either a datastore or a datastore cluster.
22
-
- Ability to enable cpu and memory hot plug features for the VM.
23
-
- Ability to enable cpu and memory reservations for the VM.
24
-
- Ability to define different datastores for data disks.
25
-
- Ability to define different scsi_controllers per disk, including data disks.
26
-
- Ability to define network type per interface and disk label per attached disk.
27
-
- Ability to define depend on using variable vm_depends_on
16
+
- Add extra data disk (up to 15) to the VM.
17
+
- Different datastores for data disks (datastore_id).
18
+
- Different scsi_controllers per disk, including data disks.
19
+
- Ability to define depend on using variable vm_depends_on & tag_depends_on
28
20
29
21
> 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.
30
22
31
-
## Usage
23
+
## Getting started
32
24
33
25
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.
34
26
35
27
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.
36
28
29
+
__Create a main.tf file and copy the following code. fill the required data and run terraform plan.__
30
+
37
31
```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
38
44
module "example-server-linuxvm" {
39
45
source = "Terraform-VMWare-Modules/vm/vsphere"
40
46
version = "X.X.X"
41
-
vmtemp = "TemplateName"
42
-
instances = 1
47
+
vmtemp = "VM Template Name (Should Alrerady exist)"
48
+
instances = 2
43
49
vmname = "example-server-linux"
44
-
vmrp = "esxi/Resources"
45
-
network_cards = ["Name of the Port Group in vSphere"]
46
-
ipv4 = {
47
-
"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 ["",""]
48
53
}
54
+
vmgateway = "10.13.113.1"
49
55
dc = "Datacenter"
50
56
datastore = "Data Store name(use ds_cluster for datastore cluster)"
51
57
}
52
58
53
-
module "example-server-windowsvm" {
54
-
source = "Terraform-VMWare-Modules/vm/vsphere"
55
-
version = "X.X.X"
56
-
vmtemp = "TemplateName"
57
-
is_windows_image = true
58
-
instances = 1
59
-
vmname = "example-server-windows"
60
-
vmrp = "esxi/Resources"
61
-
network_cards = ["Name of the Port Group in vSphere"]
62
-
ipv4 = {
63
-
"Name of the Port Group in vSphere" = ["10.0.0.1"] # To use DHCP create Empty list for each instance
64
-
}
65
-
dc = "Datacenter"
66
-
datastore = "Data Store name(use ds_cluster for datastore cluster)"
67
-
}
68
59
```
69
60
70
-
> 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.
71
-
72
61
## Advance Usage
73
62
74
63
There are number of switches defined in the module, where you can use to enable different features for VM provisioning.
75
64
76
-
### Main Feature Switches
77
-
78
65
- You can use `is_windows_image = true` to set the customization type to Windows (By default it is set to Linux customization)
79
-
- You can use `data_disk_size_gb = [20,30]` to add additional data disks (Supported in both Linux and Windows deployment)
80
-
- Above switch will create two additional disk of capacity 10 and 30gb for the VM.
81
-
- You can include `thin_provisioned` switch to define disk type for each additional disk.
82
66
- You can use `windomain = "somedomain.com"` to join a windows server to AD domain.
83
67
- Requires following additional variables
84
68
-`domainuser` Domain account with necessary privileges to join a computer to the domain.
85
69
-`domainpass` Domain user password.
86
70
-`is_windows_image` needs to be set to `true` to force the module to use Windows customization.
87
71
88
-
Below is an example of windows deployment with some of the available feature sets.
72
+
> 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.
73
+
74
+
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)
run_once = ["command01", "command02"] // You can also run Powershell commands
@@ -146,9 +129,14 @@ output "vmnames" {
146
129
output "vmnameswip" {
147
130
value = "${module.example-server-windowsvm-advanced.Windows-ip}"
148
131
}
149
-
150
132
```
151
133
134
+
## Contributing
135
+
136
+
This module is the work of many contributors. We appreciate your help!
137
+
138
+
To contribute, please read the [contribution guidelines](https://github.com/Terraform-VMWare-Modules/terraform-vsphere-vm/blob/master/CONTRIBUTING.md)
139
+
152
140
## Authors
153
141
154
142
Originally created by [Arman Keyoumarsi](https://github.com/Arman-Keyoumarsi)
0 commit comments