Reputation: 2816
I am trying to use the azurerm_resource_group_template_deployment
resource "azurerm_resource_group_template_deployment" "my-arm-template" {
parameters_content = {
location = azurerm_resource_group.my_rg.location
}
name = "my_name"
...
}
I am getting an error:
Inappropriate value for attribute "parameters_content": string required.
How should I define the parameters_content section?
Upvotes: 2
Views: 2189
Reputation: 89
I had the exact same issue and luk2302 sent me on the right track, but it needed a slight change to his answer. Thanks for your help luk2302!
The correct answer to this is:
resource "azurerm_resource_group_template_deployment" "my_template_resource_name" {
name = var.my_friendly_name
resource_group_name = azurerm_resource_group.my_rg.name
template_content = file("template_name.json")
parameters_content = jsonencode({
"location" = {
value = azurerm_resource_group.my_rg.location
}
"variable2" = {
value = var.variable2
}
})
deployment_mode = "Incremental"
}
Upvotes: 6
Reputation: 57114
You need to jsonencode
the actual argument, like
resource "azurerm_resource_group_template_deployment" "my-arm-template" {
parameters_content = jsonencode({
location = azurerm_resource_group.my_rg.location
})
...
}
Upvotes: 3