-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f658983
commit 695c0c6
Showing
13 changed files
with
637 additions
and
585 deletions.
There are no files selected for viewing
Binary file not shown.
7 changes: 0 additions & 7 deletions
7
810_onprem_vpn_gateway_p2s_hub_spokes/modules/spoke/install-webapp.sh
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
output "vm_linux_private_ip" { | ||
value = azurerm_linux_virtual_machine.vm.private_ip_address | ||
value = module.vm-spoke.vm_private_ip | ||
} |
49 changes: 0 additions & 49 deletions
49
810_onprem_vpn_gateway_p2s_hub_spokes/modules/spoke/vm-linux.tf
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
810_onprem_vpn_gateway_p2s_hub_spokes/modules/spoke/vm_linux.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module "vm-spoke" { | ||
source = "../vm_linux" | ||
|
||
vm_name = "vm-linux-${var.spoke_name}" | ||
resource_group_name = azurerm_resource_group.rg.name | ||
location = azurerm_resource_group.rg.location | ||
subnet_id = azurerm_subnet.subnet-vm.id | ||
enable_public_ip = true | ||
install_webapp = true | ||
} |
49 changes: 49 additions & 0 deletions
49
810_onprem_vpn_gateway_p2s_hub_spokes/modules/vm_linux/doc.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!-- BEGIN_TF_DOCS --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.2.8 | | ||
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | >= 3.69.0 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | >= 3.69.0 | | ||
|
||
## Modules | ||
|
||
No modules. | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [azurerm_linux_virtual_machine.vm](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/linux_virtual_machine) | resource | | ||
| [azurerm_network_interface.nic_vm](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/network_interface) | resource | | ||
| [azurerm_public_ip.pip_vm](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/public_ip) | resource | | ||
| [azurerm_resource_group.rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource | | ||
| [azurerm_role_assignment.role_contributor](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource | | ||
| [azurerm_user_assigned_identity.identity_vm](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/user_assigned_identity) | resource | | ||
| [azurerm_virtual_machine_extension.vm_extension_linux](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_machine_extension) | resource | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_admin_password"></a> [admin\_password](#input\_admin\_password) | n/a | `any` | n/a | yes | | ||
| <a name="input_admin_username"></a> [admin\_username](#input\_admin\_username) | n/a | `any` | n/a | yes | | ||
| <a name="input_enable_public_ip"></a> [enable\_public\_ip](#input\_enable\_public\_ip) | n/a | `any` | n/a | yes | | ||
| <a name="input_location"></a> [location](#input\_location) | n/a | `any` | n/a | yes | | ||
| <a name="input_resource_group_name"></a> [resource\_group\_name](#input\_resource\_group\_name) | n/a | `any` | n/a | yes | | ||
| <a name="input_subnet_id"></a> [subnet\_id](#input\_subnet\_id) | n/a | `any` | n/a | yes | | ||
| <a name="input_subscription_id"></a> [subscription\_id](#input\_subscription\_id) | n/a | `any` | n/a | yes | | ||
| <a name="input_tags"></a> [tags](#input\_tags) | n/a | `any` | n/a | yes | | ||
| <a name="input_vm_name"></a> [vm\_name](#input\_vm\_name) | n/a | `any` | n/a | yes | | ||
| <a name="input_vm_size"></a> [vm\_size](#input\_vm\_size) | n/a | `any` | n/a | yes | | ||
|
||
## Outputs | ||
|
||
No outputs. | ||
<!-- END_TF_DOCS --> |
53 changes: 53 additions & 0 deletions
53
810_onprem_vpn_gateway_p2s_hub_spokes/modules/vm_linux/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
resource "azurerm_public_ip" "pip_vm" { | ||
count = var.enable_public_ip ? 1 : 0 | ||
name = "pip-${var.vm_name}" | ||
resource_group_name = var.resource_group_name | ||
location = var.location | ||
allocation_method = "Static" | ||
sku = "Standard" | ||
sku_tier = "Regional" | ||
} | ||
|
||
resource "azurerm_network_interface" "nic_vm" { | ||
name = "nic-${var.vm_name}" | ||
resource_group_name = var.resource_group_name | ||
location = var.location | ||
|
||
ip_configuration { | ||
name = "internal" | ||
subnet_id = var.subnet_id | ||
private_ip_address_allocation = "Dynamic" | ||
public_ip_address_id = var.enable_public_ip ? azurerm_public_ip.pip_vm.0.id : null | ||
} | ||
} | ||
|
||
resource "azurerm_linux_virtual_machine" "vm" { | ||
name = var.vm_name | ||
resource_group_name = var.resource_group_name | ||
location = var.location | ||
size = "Standard_B2ats_v2" # "Standard_B2als_v2" | ||
disable_password_authentication = false | ||
admin_username = "azureuser" | ||
admin_password = "@Aa123456789" | ||
network_interface_ids = [azurerm_network_interface.nic_vm.id] | ||
priority = "Spot" | ||
eviction_policy = "Deallocate" | ||
|
||
custom_data = var.install_webapp ? filebase64("./install-webapp.sh") : null | ||
|
||
os_disk { | ||
caching = "ReadWrite" | ||
storage_account_type = "Standard_LRS" | ||
} | ||
|
||
source_image_reference { | ||
publisher = "canonical" | ||
offer = "0001-com-ubuntu-server-jammy" | ||
sku = "22_04-lts-gen2" | ||
version = "latest" | ||
} | ||
|
||
boot_diagnostics { | ||
storage_account_uri = null | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
810_onprem_vpn_gateway_p2s_hub_spokes/modules/vm_linux/output.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "vm_private_ip" { | ||
value = azurerm_linux_virtual_machine.vm.private_ip_address | ||
} |
12 changes: 12 additions & 0 deletions
12
810_onprem_vpn_gateway_p2s_hub_spokes/modules/vm_linux/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
variable "resource_group_name" {} | ||
variable "location" {} | ||
variable "subnet_id" {} | ||
variable "vm_name" {} | ||
variable "enable_public_ip" { | ||
type = bool | ||
default = false | ||
} | ||
variable "install_webapp" { | ||
type = bool | ||
default = false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.