Skip to content

Commit

Permalink
Merge pull request #3 from clouddrove/internal-21-n
Browse files Browse the repository at this point in the history
added windows module in _example folder
  • Loading branch information
anmolnagpal committed Jan 24, 2023
2 parents 2e0b693 + 497c392 commit 32f10c2
Show file tree
Hide file tree
Showing 7 changed files with 546 additions and 85 deletions.
167 changes: 119 additions & 48 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,57 +32,128 @@ include:
# How to use this project
usage: |-
Here are some examples of how you can use this module in your inventory structure:
### Default vnet-peering
### Linux Virtual Machine
```hcl
module "virtual-machine" {
source = "clouddrove/virtual-machine/azure"
version = "1.0.0"
name = "app"
environment = "test"
label_order = ["name", "environment"]
## Common
enabled = true
machine_count = 1
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
## Network Interface
subnet_id = module.subnet.default_subnet_id
private_ip_address_version = "IPv4"
private_ip_address_allocation = "Static"
primary = true
private_ip_addresses = ["10.0.1.4"]
#nsg
network_interface_sg_enabled = true
network_security_group_id = module.security_group.id
## Availability Set
availability_set_enabled = true
platform_update_domain_count = 7
platform_fault_domain_count = 3
## Public IP
public_ip_enabled = true
sku = "Basic"
allocation_method = "Static"
ip_version = "IPv4"
## Virtual Machine
linux_enabled = true
vm_size = "Standard_B1s"
file_path = "~/.ssh/id_rsa.pub"
username = "ubuntu"
os_profile_enabled = true
admin_username = "ubuntu"
create_option = "FromImage"
caching = "ReadWrite"
disk_size_gb = 30
os_type = "Linux"
managed_disk_type = "Standard_LRS"
storage_image_reference_enabled = true
image_publisher = "Canonical"
image_offer = "UbuntuServer"
image_sku = "20.04-LTS"
image_version = "latest"
name = "app"
environment = "test"
label_order = ["environment", "name"]
## Common
is_vm_linux = true
enabled = true
machine_count = 1
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
disable_password_authentication = true
## Network Interface
subnet_id = module.subnet.default_subnet_id
private_ip_address_version = "IPv4"
private_ip_address_allocation = "Static"
primary = true
private_ip_addresses = ["10.0.1.4"]
#nsg
network_interface_sg_enabled = true
network_security_group_id = module.security_group.id
## Availability Set
availability_set_enabled = true
platform_update_domain_count = 7
platform_fault_domain_count = 3
## Public IP
public_ip_enabled = true
sku = "Basic"
allocation_method = "Static"
ip_version = "IPv4"
## Virtual Machine
linux_enabled = true
vm_size = "Standard_B1s"
public_key = "ssh-rsa AAAAB3NzaC1yc2EoL9X+2+4Xb dev" # Enter valid public key here
username = "ubuntu"
os_profile_enabled = true
admin_username = "ubuntu"
# admin_password = "P@ssw0rd!123!" # It is compulsory when disable_password_authentication = false
create_option = "FromImage"
caching = "ReadWrite"
disk_size_gb = 30
os_type = "Linux"
managed_disk_type = "Standard_LRS"
storage_image_reference_enabled = true
image_publisher = "Canonical"
image_offer = "0001-com-ubuntu-server-focal"
image_sku = "20_04-lts"
image_version = "latest"
}
```
### Windows Virtual Machine
```hcl
module "virtual-machine" {
source = "clouddrove/virtual-machine/azure"
version = "1.0.0"
name = "app"
environment = "test"
label_order = ["environment", "name"]
## Common
is_vm_windows = true
enabled = true
machine_count = 1
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
disable_password_authentication = false
create_option = "FromImage"
disk_size_gb = 128
## Network Interface
subnet_id = module.subnet.default_subnet_id
private_ip_address_version = "IPv4"
private_ip_address_allocation = "Static"
primary = true
private_ip_addresses = ["10.0.1.4"]
#nsg
network_interface_sg_enabled = true
network_security_group_id = module.security_group.id
## Availability Set
availability_set_enabled = true
platform_update_domain_count = 7
platform_fault_domain_count = 3
## Public IP
public_ip_enabled = true
sku = "Basic"
allocation_method = "Static"
ip_version = "IPv4"
os_type = "windows"
computer_name="app-win-comp"
# windows_distribution_name = "windows2019dc"
vm_size = "Standard_B1s"
admin_username = "azureadmin"
admin_password = "Password@123"
image_publisher = "MicrosoftWindowsServer"
image_offer = "WindowsServer"
image_sku = "2019-Datacenter"
image_version = "latest"
enable_boot_diagnostics = false #Default is false
data_disks = [
{
name = "disk1"
disk_size_gb = 128
storage_account_type = "StandardSSD_LRS"
}
]
}
```
55 changes: 29 additions & 26 deletions _example/example.tf → _example/linux-vm/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,47 +53,49 @@ module "subnet" {
}

module "security_group" {
source = "clouddrove/network-security-group/azure"
source = "clouddrove/network-security-group/azure"
version = "1.0.0"
## Tags
name = "app"
environment = "test"
label_order = ["name", "environment"]

## Security Group
resource_group_name = module.resource_group.resource_group_name
resource_group_location = module.resource_group.resource_group_location
subnet_ids = module.subnet.default_subnet_id
resource_group_name = module.resource_group.resource_group_name
resource_group_location = module.resource_group.resource_group_location
subnet_ids = module.subnet.default_subnet_id
##Security Group rule for Custom port.
inbound_rules = [
{
name = "ssh"
priority = 101
access = "Allow"
protocol = "Tcp"
source_address_prefix = "0.0.0.0/0"
source_port_range = "*"
destination_address_prefix = "0.0.0.0/0"
destination_port_range = "22"
description = "ssh allowed port"
}]
name = "ssh"
priority = 101
access = "Allow"
protocol = "Tcp"
source_address_prefix = "0.0.0.0/0"
source_port_range = "*"
destination_address_prefix = "0.0.0.0/0"
destination_port_range = "22"
description = "ssh allowed port"
}]

}


module "virtual-machine" {
source = "../"
source = "../../"

## Tags
name = "app"
environment = "test"
label_order = ["environment", "name"]

## Common
enabled = true
machine_count = 1
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
is_vm_linux = true
enabled = true
machine_count = 1
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
disable_password_authentication = true

## Network Interface
subnet_id = module.subnet.default_subnet_id
Expand All @@ -118,12 +120,13 @@ module "virtual-machine" {


## Virtual Machine
linux_enabled = true
vm_size = "Standard_B1s"
public_key = "ssh-rsa AAAAB3NzaC1yc2EoL9X+2+4Xb dev"
username = "ubuntu"
os_profile_enabled = true
admin_username = "ubuntu"
linux_enabled = true
vm_size = "Standard_B1s"
public_key = "ssh-rsa AAAAB3NzaC1yc2EoL9X+2+4Xb dev" # Enter valid public key here
username = "ubuntu"
os_profile_enabled = true
admin_username = "ubuntu"
# admin_password = "P@ssw0rd!123!" # It is compulsory when disable_password_authentication = false
create_option = "FromImage"
caching = "ReadWrite"
disk_size_gb = 30
Expand Down
2 changes: 1 addition & 1 deletion _example/outputs.tf → _example/linux-vm/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ output "public_ip_address" {
}

output "virtual_machine_id" {
value = module.virtual-machine.virtual_machine_id
value = join("", module.virtual-machine.*.virtual_machine_id)
description = "The ID of the Virtual Machine."
}

Expand Down
Loading

0 comments on commit 32f10c2

Please sign in to comment.