diff --git a/infrastructure/adminservices-test/altinn-monitor-test-rg/data.tf b/infrastructure/adminservices-test/altinn-monitor-test-rg/data.tf index cee07df2..c86fe388 100644 --- a/infrastructure/adminservices-test/altinn-monitor-test-rg/data.tf +++ b/infrastructure/adminservices-test/altinn-monitor-test-rg/data.tf @@ -1 +1,13 @@ data "azurerm_client_config" "current" {} + +# Dialogporten +data "azurerm_resource_group" "rg_dp_test" { + name = "dp-be-test-rg" + provider = azurerm.dp +} + +data "azurerm_log_analytics_workspace" "dp_law_test" { + name = "dp-be-test-insightsWorkspace" + resource_group_name = data.azurerm_resource_group.rg_dp_test.name + provider = azurerm.dp +} diff --git a/infrastructure/adminservices-test/altinn-monitor-test-rg/grafana.tf b/infrastructure/adminservices-test/altinn-monitor-test-rg/grafana.tf index 87936f70..fd36c266 100644 --- a/infrastructure/adminservices-test/altinn-monitor-test-rg/grafana.tf +++ b/infrastructure/adminservices-test/altinn-monitor-test-rg/grafana.tf @@ -41,6 +41,21 @@ resource "azurerm_role_assignment" "grafana_identity_reader" { skip_service_principal_aad_check = true } +# Dialogporten +resource "azurerm_role_assignment" "monitoring_reader_rg_dp_test" { + scope = data.azurerm_resource_group.rg_dp_test.id + role_definition_id = "/subscriptions/${split("/", azurerm_monitor_workspace.altinn_monitor.id)[2]}/providers/Microsoft.Authorization/roleDefinitions/43d0d8ad-25c7-4714-9337-8ba259a9fe05" + principal_id = azurerm_dashboard_grafana.grafana.identity[0].principal_id + skip_service_principal_aad_check = true +} + +resource "azurerm_role_assignment" "grafana_identity_reader_rg_dp_test" { + scope = "/subscriptions/8a353de8-d81d-468d-a40d-f3574b6bb3f4" + role_definition_name = "Monitoring Reader" + principal_id = azurerm_dashboard_grafana.grafana.identity[0].principal_id + skip_service_principal_aad_check = true +} + locals { altinn_30_broker_prod_developers = "7708786a-aa50-4ce8-9f7f-e85459357de1" altinn_30_broker_test_developers = "9b99f951-3873-4310-8baf-464b4da43f26" @@ -85,3 +100,11 @@ resource "azurerm_role_assignment" "log_analytics_reader" { role_definition_name = "Log Analytics Reader" skip_service_principal_aad_check = true } + +# Dialogporten +resource "azurerm_role_assignment" "log_analytics_reader_dp_test" { + principal_id = azurerm_dashboard_grafana.grafana.identity[0].principal_id + scope = data.azurerm_log_analytics_workspace.dp_law_test.id + role_definition_name = "Log Analytics Reader" + skip_service_principal_aad_check = true +} diff --git a/infrastructure/adminservices-test/altinn-monitor-test-rg/providers.tf b/infrastructure/adminservices-test/altinn-monitor-test-rg/providers.tf index 24d63562..f5bddc34 100644 --- a/infrastructure/adminservices-test/altinn-monitor-test-rg/providers.tf +++ b/infrastructure/adminservices-test/altinn-monitor-test-rg/providers.tf @@ -20,3 +20,11 @@ provider "azurerm" { "Microsoft.KubernetesConfiguration" ] } + +# Dialogporten +provider "azurerm" { + alias = "dp" + subscription_id = "8a353de8-d81d-468d-a40d-f3574b6bb3f4" + features {} + resource_provider_registrations = "none" +}