Open mestredelpino opened 2 months ago
@mestredelpino there is a way to make this work without code changes. You have to set values to all fields of this variable log_analytics_workspace
:
It is important to set the location
field.
Also var.log_analytics_workspace_enabled
must be set to true
.
This way you can use a Log Analytics Workspace that is created in a different subscription.
The location
in var.log_analytics_workspace
is important because at:
https://github.com/Azure/terraform-azurerm-aks/blob/decb533e2785f965673698b0ac9949faca963f68/locals.tf#L57
If the location is null then you will use the datasource that does not support referencing a resource in a different subscription: https://github.com/Azure/terraform-azurerm-aks/blob/decb533e2785f965673698b0ac9949faca963f68/log_analytics.tf#L52-L57
@mestredelpino please confirm if your issue is solved. Thanks
@mestredelpino friendly ping
Hi @zioproto, I am currently getting this error
│ Error: creating Solution (Subscription: "
This is how I configured the variables suggested:
log_analytics_workspace_enabled = true
log_analytics_workspace = {
location = "westeurope"
id = "/subscriptions/<MANAGEMENT_SUBSCRIPTION_ID>/resourceGroups/es-mgmt/providers/Microsoft.OperationalInsights/workspaces/es-la/"
name = "es-la"
resource_group_name = "es-mgmt"
}
Cc: @ibersanoMS
@mestredelpino AVM is releasing an AKS resource module here: https://github.com/Azure/terraform-azurerm-avm-res-containerservice-managedcluster
It makes sense to assess first if the new module has the same issue.
Is there an existing issue for this?
Description
The Azure Landing Zones architecture expects a centralized deployment of Azure Log Analytics Workspace in the "management" subscription, while the rest of AKS resources should be on the "online" subscription. This AKS module does provide the possibility to use an existing LA workspace, but it expects it to be in the same subscription as all the other AKS resources.
The module should provide an input to properly import the LA workspace from a different subscription.
New or Affected Resource(s)/Data Source(s)
data.azurerm_log_analytics_workspace.main
Potential Terraform Configuration
References
https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/landing-zone/