From 49b0239fd440d8d6e1d6cc99efed22a54f8ce72b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 12 Jan 2024 12:55:08 +0000 Subject: [PATCH] terraform-docs: automated action --- README.md | 184 +++--------------------------------------------------- 1 file changed, 7 insertions(+), 177 deletions(-) diff --git a/README.md b/README.md index c777687..0fe4683 100644 --- a/README.md +++ b/README.md @@ -48,176 +48,6 @@ resource "azurerm_subnet" "this" { address_prefixes = [ "10.0.0.0/24" ] } ``` -###### Advanced -```hcl -locals { - location = "West Europe" - resource_group_name = "rg-examples_vm_deploy-02" - virtual_network_name = "vnet-examples_vm_deploy-02" - subnet_name = "snet-examples_vm_deploy-02" - availability_set_name = "as-examples_vm_deploy-02" - proximity_placement_group_name = "ppg-examples_vm_deploy-02" - nsg_name = "nsg-examples_vm_deploy-02" - law_name = "law-examplesvmdeploy-02" - nic = "nic-examples_vm_deploy-02" - nic_ip_config = "nic-ip-examples_vm_deploy-02" - public_ip = "pip-examples_vm_deploy-02" - virtual_machine = "vm-examples_vm_deploy-02" -} - -provider "azurerm" { - features {} -} - -module "virtual_machine" { - source = "../.." - public_ip_config = { - enabled = true - allocation_method = "Static" - } - nic_config = { - private_ip = "10.0.0.16" - dns_servers = [ "10.0.0.10", "10.0.0.11" ] - enable_accelerated_networking = true - nsg = azurerm_network_security_group.this - } - virtual_machine_config = { - hostname = "CUSTAPP007" - location = azurerm_resource_group.this.location - zone = null # Could be the default value "1", or "2" or "3". Not compatible with availability_set_id enabled. - admin_username = "qbinstall" - size = "Standard_DS1_v2" - os_sku = "20_04-lts-gen2" - os_offer = "0001-com-ubuntu-server-focal" - os_version = "latest" - os_publisher = "Canonical" - os_disk_caching = "ReadWrite" - os_disk_storage_type = "StandardSSD_LRS" - os_disk_size_gb = 64 - tags = { - "Environment" = "prd" - } - availability_set_id = azurerm_availability_set.this.id # Not compatible with zone. - write_accelerator_enabled = false - } - admin_password = "" # Write a password if you need. - public_key = file("id_rsa.pub") # If don't need rsa, leave empty with this "". - resource_group_name = azurerm_resource_group.this.name - subnet = azurerm_subnet.this - additional_network_interface_ids = [azurerm_network_interface.additional_nic_01.id] - enable_accelerated_networking = true - severity_group = "01-third-tuesday-0200-XCSUFEDTG-reboot" - update_allowed = true - - ## DISK DECLARATION - data_disks = { - shared-01 = { # Name should be: vm-CUSTAPP001-datadisk-shared-01, or use name_override - lun = 1 - tier = "P4" - caching = "ReadWrite" - disk_size_gb = 32 - create_option = "Empty" - storage_account_type = "StandardSSD_LRS" - write_accelerator_enabled = false - on_demand_bursting_enabled = false - } - sap-01 = { - lun = 2 - tier = "P4" - caching = "ReadWrite" - disk_size_gb = 32 - create_option = "Empty" - storage_account_type = "Premium_LRS" - write_accelerator_enabled = false - on_demand_bursting_enabled = false - } - } - - name_overrides = { - nic = "nic-examples_vm_CUSTAPP001" - nic_ip_config = "nic-ip-examples_vm_CUSTAPP001" - public_ip = "pip-examples_vm_CUSTAPP001" - data_disks = { - shared-01 = "vm-CUSTAPP007-datadisk-shared-01" - } - } -} - -resource "azurerm_resource_group" "this" { - name = local.resource_group_name - location = local.location -} - -resource "azurerm_virtual_network" "this" { - name = local.virtual_network_name - address_space = [ "10.0.0.0/24" ] - location = azurerm_resource_group.this.location - resource_group_name = azurerm_resource_group.this.name -} - -resource "azurerm_subnet" "this" { - name = local.subnet_name - resource_group_name = azurerm_resource_group.this.name - virtual_network_name = azurerm_virtual_network.this.name - address_prefixes = [ "10.0.0.0/24" ] -} - -resource "azurerm_availability_set" "this" { - name = local.availability_set_name - location = local.location - resource_group_name = azurerm_resource_group.this.name - proximity_placement_group_id = azurerm_proximity_placement_group.this.id -} - -resource "azurerm_proximity_placement_group" "this" { - name = local.proximity_placement_group_name - location = local.location - resource_group_name = azurerm_resource_group.this.name - - lifecycle { - ignore_changes = [tags] - } -} - -resource "azurerm_network_interface" "additional_nic_01" { - name = "nic-vm-${replace(element(azurerm_virtual_network.this.address_space,0), "/[./]/", "-")}-01" - location = local.location - resource_group_name = azurerm_resource_group.this.name - dns_servers = [] - - ip_configuration { - name = "ip-nic-01" - subnet_id = azurerm_subnet.this.id - private_ip_address_allocation = "Dynamic" - private_ip_address = null - public_ip_address_id = null - } - - lifecycle { - ignore_changes = [ - tags - ] - } -} - -resource "azurerm_network_security_group" "this" { - name = local.nsg_name - location = local.location - resource_group_name = azurerm_resource_group.this.name - - security_rule { - name = "example" - priority = 100 - direction = "Outbound" - access = "Allow" - protocol = "Tcp" - source_port_range = "*" - destination_port_range = "*" - source_address_prefix = "*" - destination_address_prefix = "*" - } -} -``` ## Requirements @@ -230,15 +60,15 @@ resource "azurerm_network_security_group" "this" { | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [resource\_group\_name](#input\_resource\_group\_name) | Name of the resource group where the resources will be created. | `string` | n/a | yes | -| [subnet](#input\_subnet) | The variable takes the subnet as input and takes the id and the address prefix for further configuration. |
object ({
id = string
address_prefixes = list(string)
})
| n/a | yes | -| [virtual\_machine\_config](#input\_virtual\_machine\_config) |
  hostname: Name of system hostname.
size: The size of the vm. Possible values can be seen here: https://learn.microsoft.com/en-us/azure/virtual-machines/sizes
location: The location of the virtual machine.
admin_username: Optionally choose the admin_username of the vm. Defaults to loc_sysadmin.
The local admin name could be changed by the gpo in the target ad.
os_sku: The os that will be running on the vm.
os_offer: (Required) Specifies the offer of the image used to create the virtual machines. Changing this forces a new resource to be created.
os_version: Optionally specify an os version for the chosen sku. Defaults to latest.
os_publisher: (Required) Specifies the Publisher of the Marketplace Image this Virtual Machine should be created from. Changing this forces a new resource to be created.
os_disk_caching: Optionally change the caching option of the os disk. Defaults to ReadWrite.
os_disk_size_gb: Optionally change the size of the os disk. Defaults to be specified by image.
os_disk_storage_type: Optionally change the os_disk_storage_type. Defaults to Premium_LRS.
zone: Optionally specify an availibility zone for the vm. Values 1, 2 or 3.
availability_set_id: Optionally specify an availibility set for the vm.
write_accelerator_enabled: Optionally activate write accelaration for the os disk. Can only
be activated on Premium_LRS disks and caching deactivated. Defaults to false.
proximity_placement_group_id: (Optional) The ID of the Proximity Placement Group which the Virtual Machine should be assigned to.
tags: Optionally specify tags in as a map.
|
object({
hostname = string
size = string
location = string
admin_username = optional(string, "loc_sysadmin")
os_sku = string
os_offer = optional(string)
os_version = optional(string, "latest")
os_publisher = optional(string)
os_disk_caching = optional(string, "ReadWrite")
os_disk_size_gb = optional(number, 64)
os_disk_storage_type = optional(string, "Premium_LRS")
zone = optional(string)
availability_set_id = optional(string)
write_accelerator_enabled = optional(bool, false)
proximity_placement_group_id = optional(string)
tags = optional(map(string))
})
| n/a | yes | +| [subnet](#input\_subnet) | The variable takes the subnet as input and takes the id and the address prefix for further configuration. |
object({
id = string
address_prefixes = list(string)
})
| n/a | yes | +| [virtual\_machine\_config](#input\_virtual\_machine\_config) |
hostname: Name of system hostname.
size: The size of the vm. Possible values can be seen here: https://learn.microsoft.com/en-us/azure/virtual-machines/sizes
location: The location of the virtual machine.
admin_username: Optionally choose the admin_username of the vm. Defaults to loc_sysadmin.
The local admin name could be changed by the gpo in the target ad.
os_sku: The os that will be running on the vm.
os_offer: (Required) Specifies the offer of the image used to create the virtual machines. Changing this forces a new resource to be created.
os_version: Optionally specify an os version for the chosen sku. Defaults to latest.
os_publisher: (Required) Specifies the Publisher of the Marketplace Image this Virtual Machine should be created from. Changing this forces a new resource to be created.
os_disk_caching: Optionally change the caching option of the os disk. Defaults to ReadWrite.
os_disk_size_gb: Optionally change the size of the os disk. Defaults to be specified by image.
os_disk_storage_type: Optionally change the os_disk_storage_type. Defaults to Premium_LRS.
zone: Optionally specify an availibility zone for the vm. Values 1, 2 or 3.
availability_set_id: Optionally specify an availibility set for the vm.
write_accelerator_enabled: Optionally activate write accelaration for the os disk. Can only
be activated on Premium_LRS disks and caching deactivated. Defaults to false.
proximity_placement_group_id: (Optional) The ID of the Proximity Placement Group which the Virtual Machine should be assigned to.
tags: Optionally specify tags in as a map.
|
object({
hostname = string
size = string
location = string
admin_username = optional(string, "loc_sysadmin")
os_sku = string
os_offer = optional(string)
os_version = optional(string, "latest")
os_publisher = optional(string)
os_disk_caching = optional(string, "ReadWrite")
os_disk_size_gb = optional(number, 64)
os_disk_storage_type = optional(string, "Premium_LRS")
zone = optional(string)
availability_set_id = optional(string)
write_accelerator_enabled = optional(bool, false)
proximity_placement_group_id = optional(string)
tags = optional(map(string))
})
| n/a | yes | | [additional\_network\_interface\_ids](#input\_additional\_network\_interface\_ids) | List of ids for additional azurerm\_network\_interface. | `list(string)` | `[]` | no | | [admin\_password](#input\_admin\_password) | Password of the local administrator. | `string` | `""` | no | -| [data\_disks](#input\_data\_disks) |
 = {
lun: Number of the lun.
disk_size_gb: The size of the data disk.
zone: Optionally specify an availibility zone for the vm. Values 1, 2 or 3.
storage_account_type: Optionally change the storage_account_type. Defaults to StandardSSD_LRS.
caching: Optionally activate disk caching. Defaults to None.
create_option: Optionally change the create option. Defaults to Empty disk.
write_accelerator_enabled: Optionally activate write accelaration for the data disk. Can only
be activated on Premium_LRS disks and caching deactivated. Defaults to false.
on_demand_bursting_enabled: Optionally activate disk bursting. . Only for Premium disk. Default false.
}
|
map(object({
lun = number
disk_size_gb = number
zone = optional(string)
caching = optional(string, "ReadWrite")
create_option = optional(string, "Empty")
storage_account_type = optional(string, "StandardSSD_LRS")
write_accelerator_enabled = optional(bool, false)
on_demand_bursting_enabled = optional(bool, false)
}))
| `{}` | no | -| [log\_analytics\_agent](#input\_log\_analytics\_agent) |
Installs the log analytics agent(MicrosoftMonitoringAgent).
workspace_id: Specify id of the log analytics workspace to which monitoring data will be sent.
shared_key: The Primary shared key for the Log Analytics Workspace..
|
object({
workspace_id = string
primary_shared_key = string
})
| `null` | no | -| [name\_overrides](#input\_name\_overrides) | Possibility to override names that will be generated according to q.beyond naming convention. |
object({
nic = optional(string)
nic_ip_config = optional(string)
public_ip = optional(string)
virtual_machine = optional(string)
os_disk = optional(string)
data_disks = optional(map(string), {})
})
| `{}` | no | -| [nic\_config](#input\_nic\_config) |
private_ip: Optioanlly specify a private ip to use. Otherwise it will  be allocated dynamically.
dns_servers: Optionally specify a list of dns servers for the nic.
enable_accelerated_networking: Enabled Accelerated networking (SR-IOV) on the NIC. The machine SKU must support this feature.
nsg_id: Optinally specify the id of a network security group that will be assigned to the nic.
|
object({
private_ip = optional(string)
dns_servers = optional(list(string))
nsg = optional(object({
id = string
}))
})
| `{}` | no | -| [public\_ip\_config](#input\_public\_ip\_config) |
enabled: Optionally select true if a public ip should be created. Defaults to false.
allocation_method: The allocation method of the public ip that will be created. Defaults to static.
|
object({
enabled = bool
allocation_method = optional(string, "Static")
})
|
{
"enabled": false
}
| no | +| [data\_disks](#input\_data\_disks) |
 = {
lun: Number of the lun.
disk_size_gb: The size of the data disk.
zone: Optionally specify an availibility zone for the vm. Values 1, 2 or 3.
storage_account_type: Optionally change the storage_account_type. Defaults to StandardSSD_LRS.
caching: Optionally activate disk caching. Defaults to None.
create_option: Optionally change the create option. Defaults to Empty disk.
write_accelerator_enabled: Optionally activate write accelaration for the data disk. Can only
be activated on Premium_LRS disks and caching deactivated. Defaults to false.
on_demand_bursting_enabled: Optionally activate disk bursting. . Only for Premium disk. Default false.
}
|
map(object({
lun = number
disk_size_gb = number
zone = optional(string)
caching = optional(string, "ReadWrite")
create_option = optional(string, "Empty")
storage_account_type = optional(string, "StandardSSD_LRS")
write_accelerator_enabled = optional(bool, false)
on_demand_bursting_enabled = optional(bool, false)
}))
| `{}` | no | +| [log\_analytics\_agent](#input\_log\_analytics\_agent) |
Installs the log analytics agent(MicrosoftMonitoringAgent).
workspace_id: Specify id of the log analytics workspace to which monitoring data will be sent.
shared_key: The Primary shared key for the Log Analytics Workspace..
|
object({
workspace_id = string
primary_shared_key = string
})
| `null` | no | +| [name\_overrides](#input\_name\_overrides) | Possibility to override names that will be generated according to q.beyond naming convention. |
object({
nic = optional(string)
nic_ip_config = optional(string)
public_ip = optional(string)
virtual_machine = optional(string)
os_disk = optional(string)
data_disks = optional(map(string), {})
})
| `{}` | no | +| [nic\_config](#input\_nic\_config) |
private_ip: Optioanlly specify a private ip to use. Otherwise it will  be allocated dynamically.
dns_servers: Optionally specify a list of dns servers for the nic.
enable_accelerated_networking: Enabled Accelerated networking (SR-IOV) on the NIC. The machine SKU must support this feature.
nsg_id: Optinally specify the id of a network security group that will be assigned to the nic.
|
object({
private_ip = optional(string)
dns_servers = optional(list(string))
enable_accelerated_networking = optional(bool, false)
nsg = optional(object({
id = string
}))
})
| `{}` | no | +| [public\_ip\_config](#input\_public\_ip\_config) |
enabled: Optionally select true if a public ip should be created. Defaults to false.
allocation_method: The allocation method of the public ip that will be created. Defaults to static.
|
object({
enabled = bool
allocation_method = optional(string, "Static")
})
|
{
"enabled": false
}
| no | | [public\_key](#input\_public\_key) | SSH public key file (e.g. file(id\_rsa.pub) | `string` | `""` | no | | [severity\_group](#input\_severity\_group) | The severity group of the virtual machine. | `string` | `""` | no | | [update\_allowed](#input\_update\_allowed) | Set the tag `Update allowed`. `True` will set `yes`, `false` to `no`. | `bool` | `true` | no |