Skip to content

orion-global/terraform-azurerm-azure_vm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Módulo para la creación de Virtual Machines en Azure

Este módulo crea una VM en Azure tanto para Windows como Linux. Los recursos a emplear son:

Aquí está la lista de parámetros totales para su referencia:


NOTA: Módulo aún en desarrollo, se recomienda no emplearlo en entornos de producción. Pendientes:

  • Todo el recurso en Windows
  • Recurso en Linux:
  • additional_capabilities
  • admin_password
  • availability_set_id
  • capacity_reservation_group_id
  • custom_data
  • dedicated_host_group_id
  • dedicated_host_id
  • disable_password_authentication
  • edge_zone
  • encryption_at_host_enabled
  • eviction_policy
  • extensions_time_budget
  • gallery_application
  • identity
  • max_bid_price
  • patch_assessment_mode
  • patch_mode
  • plan
  • platform_fault_domain
  • priority
  • provision_vm_agent
  • proximity_placement_group_id
  • secret
  • secure_boot_enabledy
  • termination_notification
  • user_data
  • virtual_machine_scale_set_id
  • vtpm_enabled
  • os_disk * diff_disk_settings(Optional) Adiff_disk_settingsblock as defined above. Changing this forces a new resource to be created. * disk_encryption_set_id * secure_vm_disk_encryption_set_id * security_encryption_type

Usage

module "module_test" {
  source                = "../../terraform-azurerm-azure_vm"
  vm_type               = "Linux"
  create_resource_group = true
  resource_group_name   = "test-rg"
  location_name         = "eastus"
  network_rg_name       = "test-rg"
  network_name          = "test-vnet"
  subnet_name           = "test-subnet"
  admin_name            = "test-admin"
  vm_sku               = "Standard_F2"
  vm_name               = "test-vm"
  network_interfaces = {
    nic-0 = { enable_zone_redundancy = true, enable_regional_endpoint = true }
    nic-1 = { enable_zone_redundancy = false, enable_regional_endpoint = true }
  }
  tags = {
    "test" = "test"
  }

}

Requirements

Name Version
terraform >= 1.1.0
azurerm >= 3.23

Providers

Name Version
azurerm >= 3.23
random n/a
tls n/a

Modules

Name Source Version
data_disks orion-global/azure_disk/azurerm 1.1.2
network_interfaces orion-global/azure_nic/azurerm 1.3.0

Resources

Name Type
azurerm_linux_virtual_machine.virtual_machine resource
azurerm_resource_group.resource_group resource
azurerm_windows_virtual_machine.virtual_machine resource
random_password.windows_password resource
tls_private_key.virtual_machine_ssh_key resource
azurerm_resource_group.resource_group data source

Inputs

Name Description Type Default Required
admin_name The name of the administrator account for the VM. string null no
admin_password The password associated with the admin_name account. string null no
admin_ssh_key The SSH public key associated with the admin_name account. string null no
allow_extension_operations Should the Virtual Machine be allowed to perform extension operations. bool true no
availability_set The ID of the Availability Set in which to place the VM. string null no
boot_diagnostics Enable or disable boot diagnostics. It will use only Managed Storage Account. bool null no
computer_name The computer name of the VM. If not specified, the VM name will be used as the computer name. string null no
create_linux_key Action for creation of Linux SSH key or not bool false no
create_resource_group Action for creation or not of the resource group bool false no
create_windows_password Action for creation of Windows password or not using random string bool false no
data_disks A list of data disks to attach to the VM. Use the Key for LUN number and all the other values for the disk configuration.
map(object({
name = optional(string)
size = number
storage_type = optional(string)
create_option = optional(string)
caching = optional(string)
write_accelerator = optional(bool)
}))
null no
license_type Specifies the type of license that will be applied to the VM. Possible values are RHEL_BYOS and SLES_BYOS for Linux VMs. Possible values are None, Windows_Client and Windows_Server for Windows VMs. string null no
location_name (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. string null no
network_interfaces A list of network interface IDs to attach to the VM.
map(object({
rg_name = optional(string)
vnet_name = string
subnet_name = string
private_ip = optional(string)
allocation = optional(string)
version = optional(string)
enable_accelerated_networking = optional(bool)
enable_ip_forwarding = optional(bool)
dns_servers = optional(list(string))
}))
null no
os_disk A os_disk block as defined below.
object({
caching = optional(string)
disk_size_gb = number
name = optional(string)
sku = optional(string) # Standard_LRS, StandardSSD_LRS, Premium_LRS, StandardSSD_ZRS, Premium_ZRS
write_accelerator = optional(string)
})
null no
os_image_id The ID of a custom image to use for the VM. This can be specified instead of a os_source_image to reference a custom image. string null no
os_image_reference Information of the OS image to use for the VM. This can be specified instead of a source_image_id to reference a published image in the Azure Marketplace. The offer, publisher, sku and version can be found by running az vm image list or in the Azure Portal. The version can be omitted to use the latest version.
object({
publisher = string
offer = string
sku = string
version = string
})
null no
provision_vm_agent Should the Virtual Machine Agent be provisioned. bool true no
proximity_group The ID of the Proximity Placement Group to use for the VM. string null no
resource_group_name (Required) The name of the resource group in which to create the Container Registry. Changing this forces a new resource to be created. string null no
tags (Optional) A mapping of tags to assign to the resource. Use the map of {tag = value} format. map(string) {} no
vm_name The name of the VM. string null no
vm_sku The size of the VM. string null no
vm_type The id of the machine image (AMI) to use for the server. string n/a yes
windows_password The password for administrator account of the Windows VM. string null no
zone The availability zone in which the VM should be created. string null no

Outputs

Name Description
network_interfaces_ids n/a
network_interfaces_names n/a
network_interfaces_private_ips n/a
private_ssh_key n/a
virtual_machine_id n/a

License

MIT Licensed. See LICENSE for full details.