To create a Red Hat Enterprise Linux (RHEL) 8.6 virtual machine using Terraform, you need to provide the correct combination of publisher
, offer
, sku
, and version
. The error you encountered ("no matching image found") suggests that the combination you provided did not match any available images in the Azure Marketplace.
For RHEL 8.6, the correct values for publisher
, offer
, and sku
are as follows:
publisher = "RedHat"
offer = "RHEL"
sku = "8.6-LVM"
Regarding the version
, you should set it to "latest" to ensure that the most recent version of the RHEL 8.6 image is used. If there's a specific version you want to use, you can specify it, but "latest" will typically suffice.
So, the correct input parameters for creating the RHEL 8.6 VM using Terraform should look like this:
provider "azurerm" {
# Your Azure provider configuration here
}
resource "azurerm_virtual_machine" "example" {
name = "example-vm"
location = "East US"
resource_group_name = "your-resource-group-name"
network_interface_ids = [azurerm_network_interface.example.id]
vm_size = "Standard_DS2_v2"
storage_image_reference {
publisher = "RedHat"
offer = "RHEL"
sku = "8.6-LVM"
version = "latest"
}
os_disk {
name = "example-osdisk"
caching = "ReadWrite"
create_option = "FromImage"
managed_disk_type = "Standard_LRS"
}
# Additional configuration for the VM
}
Make sure you have the correct Azure provider configuration above the resource block, and replace "your-resource-group-name" with the name of your desired resource group. Adjust the location
, vm_size
, and other configurations as per your requirements.
After setting up the correct parameters, you should be able to create the RHEL 8.6 VM using Terraform successfully.
Hope this information helps.
Please don’t forget to Accept Answer and Yes for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members.