|
1 | | -# Azure <> Terraform module |
2 | | -Terraform module for creation Azure <> |
| 1 | +# Azure linux vm Terraform module |
| 2 | +Terraform module for creation Azure linux vm |
3 | 3 |
|
4 | 4 | ## Usage |
5 | 5 |
|
| 6 | +```hcl |
| 7 | +# Prerequisite resources |
| 8 | +
|
| 9 | +data "azurerm_resource_group" "example" { |
| 10 | + name = "example" |
| 11 | +} |
| 12 | +
|
| 13 | +data "azurerm_subnet" "example" { |
| 14 | + name = "example" |
| 15 | + virtual_network_name = "production" |
| 16 | + resource_group_name = data.azurerm_resource_group.example.name |
| 17 | +} |
| 18 | +
|
| 19 | +resource "tls_private_key" "example" { |
| 20 | + algorithm = "RSA" |
| 21 | + ecdsa_curve = 2048 |
| 22 | +} |
| 23 | +
|
| 24 | +module "linux_virtual_machine" { |
| 25 | + source = "data-platform-hq/linux-vm/azurerm" |
| 26 | + version = "~> 1.0" |
| 27 | +
|
| 28 | + project = var.project |
| 29 | + env = var.env |
| 30 | + resource_group = data.azurerm_resource_group.example.name |
| 31 | + location = var.location |
| 32 | + subnet_id = data.azurerm_subnet.example.id |
| 33 | + |
| 34 | + admin_ssh_key = { |
| 35 | + username = "userexample" |
| 36 | + public_key = tls_private_key.example.public_key_openssh |
| 37 | + } |
| 38 | +} |
| 39 | +``` |
6 | 40 | <!-- BEGIN_TF_DOCS --> |
| 41 | +## Requirements |
| 42 | + |
| 43 | +| Name | Version | |
| 44 | +| ---------------------------------------------------------------------------- | --------- | |
| 45 | +| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 | |
| 46 | +| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | >= 3.40.0 | |
| 47 | + |
| 48 | +## Providers |
| 49 | + |
| 50 | +| Name | Version | |
| 51 | +| ---------------------------------------------------------------------- | ------- | |
| 52 | +| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | 3.40.0 | |
| 53 | + |
| 54 | + |
| 55 | +## Inputs |
| 56 | + |
| 57 | +| Name | Description | Type | Default | Required | |
| 58 | +|------|-------------|------|---------|:--------:| |
| 59 | +| <a name="input_project"></a> [project](#input\_project)| Project name | `string` | n/a | yes | |
| 60 | +| <a name="input_env"></a> [env](#input\_env)| Environment name | `string` | n/a | yes | |
| 61 | +| <a name="input_resource_group"></a> [resource\_group](#input\_resource\_group)| The name of the resource group | `string` | n/a | yes | |
| 62 | +| <a name="input_suffix"></a> [suffix](#input\_suffix)| Optional suffix that would be added to the end of resources names. It is recommended to use dash at the beginning of variable (e.x., '-example') | `string` | "" | no | |
| 63 | +| <a name="input_location"></a> [location](#input\_location)| Azure location | `string` | n/a | yes | |
| 64 | +| <a name="input_custom_virtual_machine_name"></a> [custom\_virtual\_machine\_name](#input\_custom\_virtual\_machine\_name)| Specifies the name of the virtual machine name resource | `string` | null | no | |
| 65 | +| <a name="input_custom_network_interface_name"></a> [custom\_network\_interface\_name](#input\_custom\_network\_interface\_name)| Specifies the name of the virtual machine interface name resource | `string` | null | no | |
| 66 | +| <a name="input_custom_public_ip_name"></a> [custom\_public\_ip\_name](#input\_custom\_public\_ip\_name)| Specifies the name of the public ip name name resource | `string` | null | no | |
| 67 | +| <a name="input_tags"></a> [tags](#input\_tags)| Resource tags | map(any) | {} | no | |
| 68 | +| <a name="input_subnet_id"></a> [subnet\_id](#input\_subnet\_id)| The ID of the Subnet where this Network Interface should be located in. | `string` | n/a | yes | |
| 69 | +| <a name="input_public_ip_enabled"></a> [public\_ip\_enabled](#input\_public\_ip\_enabled)| Boolean flag to enable Public Ip address creation and assignment to Virtual Machine | `bool` | true | no | |
| 70 | +| <a name="input_public_ip_allocation_method"></a> [public\_ip\_allocation\_method](#input\_public\_ip\_allocation_method)| Defines the allocation method for this IP address. Possible values are Static or Dynamic | `string` | Dynamic | no | |
| 71 | +| <a name="input_network_interface_private_ip_address_allocation"></a> [network\_interface\_private\_ip_address\_allocation](#input\_network\_interface\_private\_ip_address\_allocation)| The allocation method used for the Private IP Address. | `string` | Dynamic | no | |
| 72 | +| <a name="input_vm_size"></a> [vm\_size](#input\_vm\_size)| The SKU which should be used for this Virtual Machine. | `string` | Standard_F2 | no | |
| 73 | +| <a name="input_vm_admin_username"></a> [vm\_admin\_username](#input\_vm\_admin\_username)| The username of the local administrator used for the Virtual Machine. | `string` | adminuser | no | |
| 74 | +| <a name="input_vm_admin_password"></a> [vm\_admin\_password](#input\_vm\_admin\_password)| The password of the local administrator used for the Virtual Machine. | `string` | null | no | |
| 75 | +| <a name="input_admin_ssh_key"></a> [admin\_ssh\_key](#input\_admin\_ssh\_key)| Objects to configure ssh key reference for virtual machine | <pre>object({<br> username = string<br> public_key = string<br>})</pre> | n/a | yes | |
| 76 | +| <a name="input_os_disk"></a> [os\_disk](#input\_os\_disk)| Objects to configure os disk reference for virtual machine | <pre>object({<br> caching = string<br> storage_account_type = string<br>})</pre> | <pre>{<br> caching = "ReadWrite"<br> storage_account_type = "Standard_LRS"<br>}</pre> | no | |
| 77 | +| <a name="input_source_image_reference"></a> [source\_image\_reference](#input\_source\_image\_reference)| Objects to configure source image reference for virtual machine | <pre>object({<br> publisher = string<br> offer = string<br> sku = string<br> version = string<br>})</pre> | <pre>{<br> publisher = "Canonical"<br> offer = "0001-com-ubuntu-server-focal"<br> sku = "20_04-lts"<br> version = "latest"<br>}</pre> | no | |
| 78 | +| <a name="input_identity_enabled"></a> [identity\_enabled](#input\_identity\_enabled)| Boolean flag than enables creation of System Assigned identity to VM | `bool` | false | no | |
| 79 | +| <a name="input_password_access_enabled"></a> [password\_access\_enabled](#input\_password\_access\_enabled)| Boolean flag that enables access using password | `bool` | false | no | |
| 80 | + |
| 81 | +## Modules |
| 82 | + |
| 83 | +No modules. |
| 84 | + |
| 85 | +## Resources |
| 86 | + |
| 87 | +| Name | Type | |
| 88 | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | |
| 89 | +| [azurerm_public_ip.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/public_ip) | resource | |
| 90 | +| [azurerm_network_interface.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/network_interface) | resource | |
| 91 | +| [azurerm_linux_virtual_machine.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/linux_virtual_machine) | resource | |
| 92 | + |
| 93 | + |
| 94 | +## Outputs |
7 | 95 |
|
| 96 | +| Name | Description | |
| 97 | +| ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | |
| 98 | +| <a name="output_id"></a> [id](#output\_id) | The ID of the Linux Virtual Machine | |
| 99 | +| <a name="output_identity"></a> [identity](#output\_identity) | linux virtual machine identity | |
| 100 | +| <a name="output_public_ip"></a> [public\_ip](#output\_public\_ip) | Linux Virtual Machine public IP address | |
8 | 101 | <!-- END_TF_DOCS --> |
9 | 102 |
|
10 | 103 | ## License |
11 | 104 |
|
12 | | -Apache 2 Licensed. For more information please see [LICENSE](https://github.com/data-platform-hq/terraform-azurerm<>/tree/master/LICENSE) |
| 105 | +Apache 2 Licensed. For more information please see [LICENSE](https://github.com/data-platform-hq/terraform-azurerm-linux-vm/blob/main/LICENSE) |
0 commit comments