Hello @apparentlymart
I have been able to clear the error now, I can see the content of the file when I run this code.
provider "azurerm" {
features{}
}
locals {
resource_groupname = csvdecode(file("./ResourceTypes.csv"))
json_data = jsondecode(file("${path.module}/Monitor.json"))
}
resource "azurerm_resource_group" "Main" {
count = length(local.resource_groupname)
name = local.resource_groupname[count.index].resourcetype
location = "North europe"
}
resource "azurerm_resource_group" "name" {
# (other settings)
name = local.json_data.name
location = "North europe"
}
output "local_json_data" {
value = local.json_data
}
is there any way I can attach the attributes of the JSON file to a variable in terraform? EG. i have the “name” attribute in the JSON file. Then I want to hold that the value, attached to the “name” attribute, and assigned it to a variable in terraform.