I'm trying to build a SQL Server 2014 on Windows Server 2012 R2 Datacenter VM on Azure using Terraform.
This is how my module looks like
module "ms-sql-vm" {
source = ".../terraform_module/windows_vm"
vm_name = "ex-sql-vm"
name_space = "${module.randomename}"
arm_location = "centralus"
vm_resource_group_name = "${module....}"
availability_set_id = "${module....}"
vm_network_interface_ids = ["${module....}"]
vm_size = "Standard_D2s_v3"
vm_os_disk_name = "example-os-disk-${randomname}"
vm_os_caching = "ReadWrite"
vm_os_publisher = "MicrosoftSQLServer"
vm_os_offer = "SQL2014SP2-WS2012R2"
vm_os_sku = "Enterprise"
vm_os_version = "12.10.0"
vm_os_disk_size_gb = "127"
vm_data_disk_name = "${module.....}"
vm_data_disk_id = "${module.....}"
vm_managed_disk_type = "Standard_LRS"
vm_data_disk_size_gb = "${module.....}"
vm_data_caching = "ReadWrite"
vm_data_lun = 1
vm_admin_name = "exampleusername"
vm_admin_password = "Example12345!!"
boot_diagnostics_primary_blob_endpoint = "${module......}"
vm_delete_os_disk_on_termination = true
vm_delete_data_disk_on_termination = true
}
And I'm using this - https://www.terraform.io/docs/providers/azurerm/r/virtual_machine.html as my base module to build.
This above script is spinning up a Virtual Machine 2012 for me, but not the SQL Server. If you look at this image, after my script completes execution, I cannot fine the SQL Server Configuration Option in the image uploaded below.
If I'm spinning up the Same SQL Server 2014 SP2 Enterprise on Windows Server 2012 R2 from Azure portal, I can see the SQL Server Config Option.
And along with my VM, I'm finding this extension on my resource group dashboard as shown in the image below for VM spinned-up using Portal, but that Extension is not available if I'm doing this with Terraform. I tried to find the extension, but not able to find that extension.
The resource Type and name of this extension are
Name: SqlIaasExtension RESOURCE TYPE: Microsoft.Compute/virtualMachines/extensions
If I try to find that SqlIaasExtension with this command -
az vm extension image list-names --publisher Microsoft.Compute/virtualMachines/extensions --query"[?starts_with(name, 'SqlIaasExtension')]"
I get "The request URL is not valid."
If I try with this command below, I get an empty array []:
az vm extension image list-names --publisher Microsoft.Compute --query "[?starts_with(name, 'SqlIaasExtension')]"
Is there any way to spin up this SQL Server 2014 on Windows Server 2012 R2 Datacenter VM on Azure with Terraform?
Did anybody tried it earlier?
Thanks for the help