locals {
config = flatten(yamldecode(file(var.workspaces_config_file)))
workspaces = flatten([for x in local.config : [for w in x.workspaces : w]])
workspace_config = flatten([
for w in local.workspaces : {
terraform_version = try(w.terraform_version, null)
execution_mode = try(w.execution_mode, null)
}])
}
I am getting the following error
│ Error: Unsupported attribute
│
│ on ../workspace/locals.tf line 5, in locals:
│ 5: workspaces = flatten([for x in local.config : [for w in x.workspaces : w]])
│
│ This object does not have an attribute named "workspaces".
I am assuming I am not passing the config files the right way, although it’s not complaining about not being able to find the files.
Thanks
but you’ve referenced a file called permissions.yaml
Separately, you appear to be habitually using flatten() all over the place, which IMO is adds confusion. It looks to me like two out of your three flatten() calls are unnecessary and pass through the value unchanged, so I would remove them, personally.