Main.tf
locals {
location_mapping = [
{
"url": "L1.tfe.com"
"location": "L1"
"resource_group_name": "R1"
"name_log_workspace_name": "W1"
},
{
"url": "L2.tfe.com"
"location": "L2"
"resource_group_name": "R2"
"name_log_workspace_name": "W2"
},
{
"url": "L3.tfe.com"
"location": "L3"
"resource_group_name": "R3"
"name_log_workspace_name": "W3"
}
]
}
data "azurerm_log_analytics_workspace" "example" {
# Populate name and resource group based on var.location(L2) condition if location matches in locals
name = "W2"
resource_group_name = "R2"
}
ローカルからのデータ ブロックの条件に基づいて、nameとresource_group_nameを動的に入力したいと考えています。location and url
例
私が合格location value L2
したらurl value L2.tfe.com
、私は取得name=W2
しますresource_group_name=R2