Azure / terraform-azurerm-avm-res-azurestackhci-virtualmachineinstance

MIT License
3 stars 2 forks source link

Make the image name and type as variables, to be taken as input from … #10

Closed kumdeepakgit closed 1 week ago

kumdeepakgit commented 3 weeks ago

…the user

Description

Updated the default example in the examples/default directory.

Problem

The image name and type are hardcoded in the template, as shown below:

data "azapi_resource" "win_server_image" {
  type      = "Microsoft.AzureStackHCI/marketplaceGalleryImages@2023-09-01-preview"
  name      = "winServer2022-01"
  parent_id = data.azurerm_resource_group.rg.id
}

Solution

This PR provides a way to accept the image type and name from the user by adding the following two variables:

  1. is_marketplace_image [Optional] - Indicates whether the referenced image is from Azure Marketplace. If set to true, the type used will be Microsoft.AzureStackHCI/marketplaceGalleryImages; otherwise, it will be Microsoft.AzureStackHCI/galleryImages. This variable is optional and defaults to true.
  2. image_name - Specifies the name of the image used to create the ARC VM.

Type of Change

Checklist