Hello. I have two resource for a shared image:
resource "azurerm_shared_image" "windows1"
and
resource "azurerm_shared_image" "windows2"
I also have an Azurerm Resource Group Template Deployment
resource "azurerm_resource_group_template_deployment" "example"
Within here, inside the parameters_content if want to call the resource “azurerm_shared_image” “windows1”. When I do this, the expected resource id is returned.
like
"galleryImageId": {"value":"${azurerm_shared_image.windows1.id}"}
However, let’s say I want to make the shared image a variable, so that the user can type “windows1” or “windows2” (actually, it would really be:)
azurerm_shared_image.windows1
If I create:
variable "image" { type = string }
when I call var.image in the template, perhaps like this:
"galleryImageId": {"value":"${var.image}.id"}
the terraform output errors because the literal string of the variable azurerm_shared_image.windows1.id is returned
Field 'galleryImageId' has a bad value: 'azurerm_shared_image.windows1.id'
How to solve?