I want the additional configuration options that come with azurerm_managed_disk, and to also be able to use the os_profile and os_profile_windows_config blocks. It seems I can only have one or the other. How can I have all the options and abilities of both?
resource "azurerm_virtual_machine" "RTN_webserver01" {
availability_set_id = azurerm_availability_set.RTN_AS_Web.id
# delete_data_disks_on_termination = null
# delete_os_disk_on_termination = null
# license_type = null
location = var.location
name = "${var.resource_group_name}_webserver01"
network_interface_ids = [azurerm_network_interface.RTN_web01_nic.id]
# primary_network_interface_id = null
# proximity_placement_group_id = null
resource_group_name = azurerm_resource_group.RTN_thisRG.name
tags = {}
vm_size = "Standard_B2ms"
# zones = []
# additional_capabilities {
# ultra_ssd_enabled = null
# }
boot_diagnostics {
enabled = true
storage_uri = azurerm_storage_account.RTN_storage_account.primary_blob_endpoint
}
os_profile {
admin_password = var.altecadminpw
admin_username = "altecadmin"
computer_name = "${var.resource_group_name}web01"
# custom_data = null
}
# You cannot set os_profile when using an existing Windows image
os_profile_windows_config {
enable_automatic_upgrades = true
#Windows Azure Guest Agent Service is for communication with the VM host
provision_vm_agent = true
timezone = "Pacific Standard Time"
}
storage_image_reference {
id = "/subscriptions/....../providers/Microsoft.Compute/galleries/Images/images/WebServer2019"
}
# storage_os_disk name must be the same name as the managed disk name
storage_os_disk {
caching = "ReadWrite"
create_option = "FromImage"
disk_size_gb = 127
# image_uri = null
# managed_disk_id = azurerm_managed_disk.RTN_web01_OSdisk.id
managed_disk_type = "Premium_LRS"
# name = azurerm_managed_disk.RTN_web01_OSdisk.name
name = "${var.resource_group_name}web01osdisk"
os_type = "Windows"
# vhd_uri = null
write_accelerator_enabled = false
}
}
# resource "azurerm_managed_disk" "RTN_web01_OSdisk" {
# create_option = "FromImage"
# # create_option = "Empty"
# # disk_access_id = null
# # disk_encryption_set_id = null
# # disk_iops_read_only = 0
# # disk_iops_read_write = 500
# # disk_mbps_read_only = 0
# # disk_mbps_read_write = 100
# disk_size_gb = 127
# # edge_zone = null
# gallery_image_reference_id = "/subscriptions/.........../providers/Microsoft.Compute/galleries/Images/images/WebServer2019/versions/1.0.0"
# hyper_v_generation = "V1"
# # image_reference_id = null
# location = var.location
# # logical_sector_size = null
# # max_shares = 0
# name = "${var.resource_group_name}_websvr01_OSdisk"
# # network_access_policy = null
# on_demand_bursting_enabled = false
# optimized_frequent_attach_enabled = false
# os_type = "Windows"
# performance_plus_enabled = false
# public_network_access_enabled = true
# resource_group_name = azurerm_resource_group.RTN_thisRG.name
# # secure_vm_disk_encryption_set_id = null
# # security_type = null
# # source_resource_id = null
# # source_uri = null
# # storage_account_id = null
# storage_account_type = "Premium_LRS"
# tags = {}
# tier = "P10"
# trusted_launch_enabled = false
# # upload_size_bytes = 0
# # zone = null
# }