### Example Configuration for Azure Shared Image Gallery (HCL) Source: https://github.com/azure/terraform-azurerm-avm-res-compute-gallery/blob/main/examples/shared-image-gallery/README.md This HCL code block provides a complete example of how to deploy an Azure Shared Image Gallery using the specified Terraform module. It includes calls to helper modules for naming and region selection, defines a random integer resource for region randomization, creates a resource group, and finally instantiates the `compute_gallery` module. ```HCL # This ensures we have unique CAF compliant names for our resources. module "naming" { source = "Azure/naming/azurerm" version = "0.4.1" } module "regions" { source = "Azure/avm-utl-regions/azurerm" version = "~> 0.1" availability_zones_filter = true } # This allows us to randomize the region for the resource group. resource "random_integer" "region_index" { max = length(module.regions.regions) - 1 min = 0 } # This is required for resource modules resource "azurerm_resource_group" "this" { location = module.regions.regions[random_integer.region_index.result].name name = module.naming.resource_group.name_unique tags = local.tags } module "compute_gallery" { source = "../../" location = azurerm_resource_group.this.location name = module.naming.shared_image_gallery.name_unique resource_group_name = azurerm_resource_group.this.name ## Optional description = "This is a test compute gallery" } ``` -------------------------------- ### Deploying Azure Shared Image Gallery with Terraform HCL Source: https://github.com/azure/terraform-azurerm-avm-res-compute-gallery/blob/main/examples/shared-image-gallery-image/README.md This HCL code snippet demonstrates the usage of the `terraform-azurerm-avm-res-compute-gallery` module to create an Azure Shared Image Gallery. It utilizes helper modules for generating unique names and selecting a random region, creates a resource group, and defines two image definitions within the gallery: one for Linux and one for Windows. ```HCL # This ensures we have unique CAF compliant names for our resources. module "naming" { source = "Azure/naming/azurerm" version = "0.4.1" } module "regions" { source = "Azure/avm-utl-regions/azurerm" version = "~> 0.1" availability_zones_filter = true } # This allows us to randomize the region for the resource group. resource "random_integer" "region_index" { max = length(module.regions.regions) - 1 min = 0 } # This is required for resource modules resource "azurerm_resource_group" "this" { location = module.regions.regions[random_integer.region_index.result].name name = module.naming.resource_group.name_unique tags = local.tags } module "compute_gallery" { source = "../../" location = azurerm_resource_group.this.location name = module.naming.shared_image_gallery.name_unique resource_group_name = azurerm_resource_group.this.name ## Optional description = "This is a test compute gallery" shared_image_definitions = { img01 = { name = "lin-image" os_type = "Linux" identifier = { publisher = "RedHat" offer = "RHEL" sku = "810-gen2" } } img02 = { name = "win-image" os_type = "Windows" identifier = { publisher = "MicrosoftWindowsServer" offer = "WindowsServer" sku = "2019-datacenter-gensecond" } } } } ``` -------------------------------- ### Define Image Version Type in HCL Source: https://github.com/azure/terraform-azurerm-avm-res-compute-gallery/blob/main/README.md Defines the complex object type used for specifying image versions within the Azure Compute Gallery module. It includes various optional attributes like publisher, product, description, architecture, vCPU/memory recommendations, and feature flags. ```HCL object({ name = string publisher = optional(string) product = optional(string) })) description = optional(string) disk_types_not_allowed = optional(list(string)) end_of_life_date = optional(string) eula = optional(string) specialized = optional(bool) architecture = optional(string, "x64") hyper_v_generation = optional(string, "V1") max_recommended_vcpu_count = optional(number) min_recommended_vcpu_count = optional(number) max_recommended_memory_in_gb = optional(number) min_recommended_memory_in_gb = optional(number) privacy_statement_uri = optional(string) release_note_uri = optional(string) trusted_launch_enabled = optional(bool) confidential_vm_supported = optional(bool) confidential_vm_enabled = optional(bool) accelerated_network_support_enabled = optional(bool) tags = optional(map(string)) }) ``` -------------------------------- ### Define Tags Type in HCL Source: https://github.com/azure/terraform-azurerm-avm-res-compute-gallery/blob/main/README.md Defines the type for the `tags` input variable, which is a map of strings used for resource tagging. ```HCL map(string) ``` -------------------------------- ### Define Sharing Configuration Type in HCL Source: https://github.com/azure/terraform-azurerm-avm-res-compute-gallery/blob/main/README.md Specifies the object type for configuring sharing options for the Azure Compute Gallery. It includes the required permission level and an optional nested object for community gallery settings. ```HCL object({ permission = string community_gallery = optional(object({ eula = string prefix = string publisher_email = string publisher_uri = string })) }) ``` -------------------------------- ### Define Azure Compute Gallery Shared Image Definitions Type (HCL) Source: https://github.com/azure/terraform-azurerm-avm-res-compute-gallery/blob/main/README.md This HCL snippet defines the expected structure for the `shared_image_definitions` input variable. It specifies that the variable should be a map where each element is an object representing a shared image definition, including nested objects for `identifier` and optional `purchase_plan`, along with other attributes like `name` and `os_type`. ```HCL map(object({ name = string identifier = object({ publisher = string offer = string sku = string }) os_type = string purchase_plan = optional(object({ ``` -------------------------------- ### Define Timeouts Configuration Type in HCL Source: https://github.com/azure/terraform-azurerm-avm-res-compute-gallery/blob/main/README.md Specifies the object type for configuring custom timeouts for create, delete, read, and update operations on the Azure Compute Gallery resource. ```HCL object({ create = optional(string) delete = optional(string) read = optional(string) update = optional(string) }) ``` -------------------------------- ### Define Terraform Variable Type for Role Assignments Map (HCL) Source: https://github.com/azure/terraform-azurerm-avm-res-compute-gallery/blob/main/README.md Defines the HCL map of objects type for the `role_assignments` input variable. This variable allows assigning roles to principals on the Compute Gallery, requiring `role_definition_id_or_name` and `principal_id`, and supporting various optional properties like `description`, `condition`, and `principal_type`. ```hcl map(object({ role_definition_id_or_name = string principal_id = string description = optional(string, null) skip_service_principal_aad_check = optional(bool, false) condition = optional(string, null) condition_version = optional(string, null) delegated_managed_identity_resource_id = optional(string, null) principal_type = optional(string, null) })) ``` -------------------------------- ### Define Terraform Variable Type for Resource Lock (HCL) Source: https://github.com/azure/terraform-azurerm-avm-res-compute-gallery/blob/main/README.md Defines the HCL object type for the `lock` input variable. This variable is used to configure Azure Resource Locks on the Compute Gallery resource, specifying the lock `kind` (required, 'CanNotDelete' or 'ReadOnly') and an optional `name`. ```hcl object({ kind = string name = optional(string, null) }) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.