Skip to content

Commit 7bdc7b9

Browse files
authored
Merge pull request #2 from kumarvna/develop
adding terraform 0.15 support
2 parents 87b45fe + b54b017 commit 7bdc7b9

File tree

15 files changed

+260
-109
lines changed

15 files changed

+260
-109
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# .tfstate files
55
*.tfstate
66
*.tfstate.*
7+
*.terraform.lock.hcl
78

89
# Crash log files
910
crash.log

README.md

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,22 @@ These types of resources supported:
1919
```hcl
2020
module "virtual-machine" {
2121
source = "kumarvna/virtual-machine/azurerm"
22-
version = "2.0.0"
22+
version = "2.1.0"
2323
2424
# Resource Group, location, VNet and Subnet details
25-
resource_group_name = "rg-hub-demo-internal-shared-westeurope-001"
25+
resource_group_name = "rg-shared-westeurope-01"
2626
location = "westeurope"
27-
virtual_network_name = "vnet-default-hub-westeurope"
28-
subnet_name = "snet-management-default-hub-westeurope"
27+
virtual_network_name = "vnet-shared-hub-westeurope-001"
28+
subnet_name = "snet-management"
2929
virtual_machine_name = "vm-linux"
3030
3131
# (Optional) To enable Azure Monitoring and install log analytics agents
32-
log_analytics_workspace_name = var.log_analytics_workspace_id
33-
hub_storage_account_name = var.hub_storage_account_id
32+
log_analytics_workspace_name = var.log_analytics_workspace_name
33+
hub_storage_account_name = var.hub_storage_account_name
34+
35+
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
36+
# Defaults to `false`
37+
deploy_log_analytics_agent = false
3438
3539
# This module support multiple Pre-Defined Linux and Windows Distributions.
3640
# Linux images: ubuntu1804, ubuntu1604, centos75, centos77, centos81, coreos
@@ -49,9 +53,12 @@ module "virtual-machine" {
4953
instances_count = 2
5054
enable_vm_availability_set = true
5155
56+
# Add public IP to your VM
57+
enable_public_ip_address = true
58+
5259
# Network Seurity group port allow definitions for each Virtual Machine
5360
# NSG association to be added automatically for all network interfaces.
54-
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
61+
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
5562
# For production environments, recommended to use a VPN or private connection.
5663
nsg_inbound_rules = [
5764
{
@@ -68,7 +75,7 @@ module "virtual-machine" {
6875
]
6976
7077
# Adding TAG's to your Azure resources (Required)
71-
# ProjectName and Env are already declared above, to use them here, create a varible.
78+
# ProjectName and Env are already declared above, to use them here, create a varible.
7279
tags = {
7380
ProjectName = "demo-internal"
7481
Env = "dev"
@@ -81,9 +88,9 @@ module "virtual-machine" {
8188

8289
## Default Local Administrator and the Password
8390

84-
This module utilizes __`azureadmin`__ as a local administrator on virtual machines. If you want to you use custom username, then specify the same by setting up the argument `admin_username` with valid user string.
91+
This module utilizes __`azureadmin`__ as a local administrator on virtual machines. If you want to you use custom username, then specify the same by setting up the argument `admin_username` with a valid user string.
8592

86-
By default, this module generates a strong password for all virtual machines. If you want to set the custom password, specify the argument `admin_password` with valid string.
93+
By default, this module generates a strong password for all virtual machines also allows you to change the length of the random password (currently 24) using the `random_password_length = 32` variable. If you want to set the custom password, specify the argument `admin_password` with a valid string.
8794

8895
This module also generates SSH2 Key pair for Linux servers by default, however, it is only recommended to use for dev environment. For production environments, please generate your own SSH2 key with a passphrase and input the key by providing the path to the argument `admin_ssh_key_data`.
8996

@@ -108,7 +115,7 @@ If the pre-defined Windows or Linux variants are not sufficient then, you can sp
108115
```hcl
109116
module "virtual-machine" {
110117
source = "kumarvna/virtual-machine/azurerm"
111-
version = "2.0.0"
118+
version = "2.1.0"
112119
113120
# .... omitted
114121
@@ -200,7 +207,7 @@ In the Source and Destination columns, `VirtualNetwork`, `AzureLoadBalancer`, an
200207
```hcl
201208
module "virtual-machine" {
202209
source = "kumarvna/virtual-machine/azurerm"
203-
version = "2.0.0"
210+
version = "2.1.0"
204211
205212
# .... omitted
206213
@@ -260,7 +267,7 @@ End Date of the Project|Date when this application, workload, or service is plan
260267
```hcl
261268
module "virtual-machine" {
262269
source = "kumarvna/virtual-machine/azurerm"
263-
version = "2.0.0"
270+
version = "2.1.0"
264271
265272
# Resource Group, location, VNet and Subnet details
266273
resource_group_name = "rg-hub-demo-internal-shared-westeurope-001"
@@ -277,6 +284,21 @@ module "virtual-machine" {
277284
}
278285
```
279286

287+
## Requirements
288+
289+
| Name | Version |
290+
|------|---------|
291+
| terraform | >= 0.13 |
292+
| azurerm | >= 2.59.0 |
293+
294+
## Providers
295+
296+
| Name | Version |
297+
|------|---------|
298+
| azurerm | >= 2.59.0 |
299+
| random | n/a |
300+
| tls | n/a |
301+
280302
## Inputs
281303

282304
Name | Description | Type | Default
@@ -295,22 +317,29 @@ Name | Description | Type | Default
295317
`private_ip_address`|The Static IP Address which should be used. This is valid only when `private_ip_address_allocation` is set to `Static`.|string|`null`
296318
`dns_servers`|List of dns servers to use for network interface|string|`[]`
297319
`enable_vm_availability_set`|Manages an Availability Set for Virtual Machines.|string|`false`
320+
`platform_fault_domain_count`|Specifies the number of fault domains that are used|number|`3`
321+
`platform_update_domain_count`|Specifies the number of update domains that are used|number|`5`
298322
`enable_public_ip_address`|Reference to a Public IP Address to associate with the NIC|string|`false`
323+
`public_ip_allocation_method`|Defines the allocation method for this IP address. Possible values are `Static` or `Dynamic`|string|`Static`
324+
`public_ip_sku`|The SKU of the Public IP. Accepted values are `Basic` and `Standard`|string|`Standard`
299325
`source_image_id`|The ID of an Image which each Virtual Machine should be based on|string|`null`
300326
`custom_image`|Provide the custom image to this module if the default variants are not sufficient|map(object)|`null`
301327
`linux_distribution_list`|Pre-defined Azure Linux VM images list|map(object)|`ubuntu1804`
302328
`linux_distribution_name`|Variable to pick an OS flavor for Linux based Virtual Machine. Possible values are `centos81`, `centos77`, `centos77`, `ubuntu1804`, `ubuntu1604`, `coreos`, `mssql2019ent-rhel8`, `mssql2019std-rhel8`, `mssql2019dev-rhel8`, `mssql2019ent-ubuntu1804`, `mssql2019std-ubuntu1804`, `mssql2019dev-ubuntu1804`|string|`ubuntu1804`
303329
`windows_distribution_list`|Pre-defined Azure Windows VM images list|map(object)|`"windows2019dc"`
304330
`windows_distribution_name`|Variable to pick an OS flavor for Windows based VM. Possible values are `windows2012r2dc`, `windows2016dc`, `windows2019dc`, `windows2016dccore`, `mssql2017exp`, `mssql2017dev`, `mssql2017std`, `mssql2017ent`, `mssql2019dev`, `mssql2019std`, `mssql2019ent`, `mssql2019ent-byol`, `mssql2019std-byol`|string|`"windows2019dc"`
305331
`os_disk_storage_account_type`|The Type of Storage Account for Internal OS Disk. Possible values include Standard_LRS, StandardSSD_LRS and Premium_LRS.|string|`"StandardSSD_LRS"`
332+
`enable_ultra_ssd_data_disk_storage_support`|Should the capacity to enable Data Disks of the UltraSSD_LRS storage account type be supported on this Virtual Machine|string|`false`
306333
`generate_admin_ssh_key`|Generates a secure private key and encodes it as PEM|string|`true`
307334
`admin_ssh_key_data`|specify the path to the existing SSH key to authenticate Linux virtual machine|string|`""`
308335
`admin_username`|The username of the local administrator used for the Virtual Machine|string|`"azureadmin"`
309336
`admin_password`|The Password which should be used for the local-administrator on this Virtual Machine|string|`null`
337+
`random_password_length`|The desired length of random password created by this module|number|`24`
310338
`disable_password_authentication`|Should Password Authentication be disabled on this Virtual Machine. Applicable to Linux Virtual machine|string|`true`
311339
`nsg_inbound_rules`|List of network rules to apply to network interface|object|`{}`
312340
`dedicated_host_id`|The ID of a Dedicated Host where this machine should be run on|string|`null`
313341
`license_type`|Specifies the type of on-premise license which should be used for this Virtual Machine. Possible values are `None`, `Windows_Client` and `Windows_Server`.|string|`"None"`
342+
`vm_time_zone`|Specifies the Time Zone which should be used by the Virtual Machine. Ex. `"UTC"` or `"W. Europe Standard Time"` [The possible values are defined here](https://jackstromberg.com/2017/01/list-of-time-zones-consumed-by-azure/) |string|`null`
314343
`Tags`|A map of tags to add to all resources|map|`{}`
315344

316345
## Outputs
@@ -335,7 +364,7 @@ Name | Description | Type | Default
335364

336365
## Authors
337366

338-
Module is maintained by [Kumaraswamy Vithanala](mailto:[email protected]) with the help from other awesome contributors.
367+
Originally created by [Kumaraswamy Vithanala](mailto:[email protected]).
339368

340369
## Other resources
341370

examples/README.md

Lines changed: 50 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,22 @@ This terraform module is designed to deploy azure Windows or Linux virtual machi
99
```hcl
1010
module "virtual-machine" {
1111
source = "kumarvna/virtual-machine/azurerm"
12-
version = "2.0.0"
12+
version = "2.1.0"
1313
1414
# Resource Group, location, VNet and Subnet details
15-
resource_group_name = "rg-hub-demo-internal-shared-westeurope-001"
15+
resource_group_name = "rg-shared-westeurope-01"
1616
location = "westeurope"
17-
virtual_network_name = "vnet-default-hub-westeurope"
18-
subnet_name = "snet-management-default-hub-westeurope"
17+
virtual_network_name = "vnet-shared-hub-westeurope-001"
18+
subnet_name = "snet-management"
1919
virtual_machine_name = "vm-linux"
2020
2121
# (Optional) To enable Azure Monitoring and install log analytics agents
22-
log_analytics_workspace_name = var.log_analytics_workspace_id
23-
hub_storage_account_name = var.hub_storage_account_id
22+
log_analytics_workspace_name = var.log_analytics_workspace_name
23+
hub_storage_account_name = var.hub_storage_account_name
24+
25+
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
26+
# Defaults to `false`
27+
deploy_log_analytics_agent = false
2428
2529
# This module support multiple Pre-Defined Linux and Windows Distributions.
2630
# Linux images: ubuntu1804, ubuntu1604, centos75, centos77, centos81, coreos
@@ -39,9 +43,12 @@ module "virtual-machine" {
3943
instances_count = 2
4044
enable_vm_availability_set = true
4145
46+
# Add public IP to your VM
47+
enable_public_ip_address = true
48+
4249
# Network Seurity group port allow definitions for each Virtual Machine
4350
# NSG association to be added automatically for all network interfaces.
44-
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
51+
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
4552
# For production environments, recommended to use a VPN or private connection.
4653
nsg_inbound_rules = [
4754
{
@@ -58,7 +65,7 @@ module "virtual-machine" {
5865
]
5966
6067
# Adding TAG's to your Azure resources (Required)
61-
# ProjectName and Env are already declared above, to use them here, create a varible.
68+
# ProjectName and Env are already declared above, to use them here, create a varible.
6269
tags = {
6370
ProjectName = "demo-internal"
6471
Env = "dev"
@@ -74,18 +81,22 @@ module "virtual-machine" {
7481
```hcl
7582
module "virtual-machine" {
7683
source = "kumarvna/virtual-machine/azurerm"
77-
version = "2.0.0"
84+
version = "2.1.0"
7885
7986
# Resource Group, location, VNet and Subnet details
80-
resource_group_name = "rg-hub-demo-internal-shared-westeurope-001"
87+
resource_group_name = "rg-shared-westeurope-01"
8188
location = "westeurope"
82-
virtual_network_name = "vnet-default-hub-westeurope"
83-
subnet_name = "snet-management-default-hub-westeurope"
84-
virtual_machine_name = "vm-linux"
89+
virtual_network_name = "vnet-shared-hub-westeurope-001"
90+
subnet_name = "snet-management"
91+
virtual_machine_name = "win-machine"
8592
8693
# (Optional) To enable Azure Monitoring and install log analytics agents
87-
log_analytics_workspace_name = var.log_analytics_workspace_id
88-
hub_storage_account_name = var.hub_storage_account_id
94+
log_analytics_workspace_name = var.log_analytics_workspace_name
95+
hub_storage_account_name = var.hub_storage_account_name
96+
97+
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
98+
# Defaults to `false`
99+
deploy_log_analytics_agent = false
89100
90101
# This module support multiple Pre-Defined Linux and Windows Distributions.
91102
# Linux images: ubuntu1804, ubuntu1604, centos75, centos77, centos81, coreos
@@ -103,11 +114,13 @@ module "virtual-machine" {
103114
admin_password = "P@$$w0rd1234!"
104115
instances_count = 2
105116
enable_vm_availability_set = true
106-
enable_public_ip_address = true
117+
118+
# Add public IP to your VM
119+
enable_public_ip_address = true
107120
108121
# Network Seurity group port allow definitions for each Virtual Machine
109122
# NSG association to be added automatically for all network interfaces.
110-
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
123+
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
111124
# For production environments, recommended to use a VPN or private connection.
112125
nsg_inbound_rules = [
113126
{
@@ -124,7 +137,7 @@ module "virtual-machine" {
124137
]
125138
126139
# Adding TAG's to your Azure resources (Required)
127-
# ProjectName and Env are already declared above, to use them here, create a varible.
140+
# ProjectName and Env are already declared above, to use them here, create a varible.
128141
tags = {
129142
ProjectName = "demo-internal"
130143
Env = "dev"
@@ -140,18 +153,23 @@ module "virtual-machine" {
140153
```hcl
141154
module "virtual-machine" {
142155
source = "kumarvna/virtual-machine/azurerm"
143-
version = "2.0.0"
156+
version = "2.1.0"
157+
144158
145159
# Resource Group, location, VNet and Subnet details
146-
resource_group_name = "rg-hub-demo-internal-shared-westeurope-001"
160+
resource_group_name = "rg-shared-westeurope-01"
147161
location = "westeurope"
148-
virtual_network_name = "vnet-default-hub-westeurope"
149-
subnet_name = "snet-management-default-hub-westeurope"
150-
virtual_machine_name = "vm-linux"
162+
virtual_network_name = "vnet-shared-hub-westeurope-001"
163+
subnet_name = "snet-management"
164+
virtual_machine_name = "win-sqlvm"
151165
152166
# (Optional) To enable Azure Monitoring and install log analytics agents
153-
log_analytics_workspace_name = var.log_analytics_workspace_id
154-
hub_storage_account_name = var.hub_storage_account_id
167+
log_analytics_workspace_name = var.log_analytics_workspace_name
168+
hub_storage_account_name = var.hub_storage_account_name
169+
170+
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
171+
# Defaults to `false`
172+
deploy_log_analytics_agent = false
155173
156174
# This module support multiple Pre-Defined Linux and Windows Distributions.
157175
# Linux images: ubuntu1804, ubuntu1604, centos75, centos77, centos81, coreos
@@ -163,16 +181,19 @@ module "virtual-machine" {
163181
# Ubuntu images: mssql2019ent-ubuntu1804, mssql2019std-ubuntu1804, mssql2019dev-ubuntu1804
164182
# Bring your own License (BOYL) images: mssql2019ent-byol, mssql2019std-byol
165183
os_flavor = "windows"
166-
windows_distribution_name = "mssql2017std"
184+
windows_distribution_name = "mssql2019std"
167185
virtual_machine_size = "Standard_A2_v2"
168186
admin_username = "azureadmin"
169-
admin_password = "complex_password"
187+
admin_password = "P@$$w0rd1234!"
170188
instances_count = 2
171189
enable_vm_availability_set = true
172190
191+
# Add public IP to your VM
192+
enable_public_ip_address = true
193+
173194
# Network Seurity group port allow definitions for each Virtual Machine
174195
# NSG association to be added automatically for all network interfaces.
175-
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
196+
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
176197
# For production environments, recommended to use a VPN or private connection.
177198
nsg_inbound_rules = [
178199
{
@@ -189,7 +210,7 @@ module "virtual-machine" {
189210
]
190211
191212
# Adding TAG's to your Azure resources (Required)
192-
# ProjectName and Env are already declared above, to use them here, create a varible.
213+
# ProjectName and Env are already declared above, to use them here, create a varible.
193214
tags = {
194215
ProjectName = "demo-internal"
195216
Env = "dev"

examples/linux_virtual_machine/README.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,22 @@ This terraform module is designed to deploy azure Linux virtual machines with Pu
77
```hcl
88
module "virtual-machine" {
99
source = "kumarvna/virtual-machine/azurerm"
10-
version = "2.0.0"
10+
version = "2.1.0"
1111
1212
# Resource Group, location, VNet and Subnet details
13-
resource_group_name = "rg-hub-demo-internal-shared-westeurope-001"
13+
resource_group_name = "rg-shared-westeurope-01"
1414
location = "westeurope"
15-
virtual_network_name = "vnet-default-hub-westeurope"
16-
subnet_name = "snet-management-default-hub-westeurope"
15+
virtual_network_name = "vnet-shared-hub-westeurope-001"
16+
subnet_name = "snet-management"
1717
virtual_machine_name = "vm-linux"
1818
1919
# (Optional) To enable Azure Monitoring and install log analytics agents
20-
log_analytics_workspace_name = var.log_analytics_workspace_id
21-
hub_storage_account_name = var.hub_storage_account_id
20+
log_analytics_workspace_name = var.log_analytics_workspace_name
21+
hub_storage_account_name = var.hub_storage_account_name
22+
23+
# Deploy log analytics agents to virtual machine. Log analytics workspace name required.
24+
# Defaults to `false`
25+
deploy_log_analytics_agent = false
2226
2327
# This module support multiple Pre-Defined Linux and Windows Distributions.
2428
# Linux images: ubuntu1804, ubuntu1604, centos75, centos77, centos81, coreos
@@ -37,9 +41,12 @@ module "virtual-machine" {
3741
instances_count = 2
3842
enable_vm_availability_set = true
3943
44+
# Add public IP to your VM
45+
enable_public_ip_address = true
46+
4047
# Network Seurity group port allow definitions for each Virtual Machine
4148
# NSG association to be added automatically for all network interfaces.
42-
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
49+
# SSH port 22 and 3389 is exposed to the Internet recommended for only testing.
4350
# For production environments, recommended to use a VPN or private connection.
4451
nsg_inbound_rules = [
4552
{
@@ -56,7 +63,7 @@ module "virtual-machine" {
5663
]
5764
5865
# Adding TAG's to your Azure resources (Required)
59-
# ProjectName and Env are already declared above, to use them here, create a varible.
66+
# ProjectName and Env are already declared above, to use them here, create a varible.
6067
tags = {
6168
ProjectName = "demo-internal"
6269
Env = "dev"

0 commit comments

Comments
 (0)