diff --git a/infra/templates/osdu-r3-mvp/central_resources/main.tf b/infra/templates/osdu-r3-mvp/central_resources/main.tf index 6957d137e33f01cd9fca16121c4e82d0f1f7ab3c..18abd0e288ffcddb10be57cb5485d927e1033c31 100644 --- a/infra/templates/osdu-r3-mvp/central_resources/main.tf +++ b/infra/templates/osdu-r3-mvp/central_resources/main.tf @@ -302,6 +302,7 @@ module "service_principal" { module "ad_application" { + count = var.enable_bring_your_own_ad_app ? 0 : 1 source = "../../../modules/providers/azure/ad-application" name = local.ad_app_name diff --git a/infra/templates/osdu-r3-mvp/central_resources/secrets.tf b/infra/templates/osdu-r3-mvp/central_resources/secrets.tf index d400d69a9a3fb057340bb23b2864fdd1bf882980..9c5b4d5d8108c45e6ec4fe557bd9acf19f907567 100644 --- a/infra/templates/osdu-r3-mvp/central_resources/secrets.tf +++ b/infra/templates/osdu-r3-mvp/central_resources/secrets.tf @@ -154,8 +154,10 @@ resource "azurerm_key_vault_secret" "principal_object_id" { // Add Application Information to KV resource "azurerm_key_vault_secret" "application_id" { + count = var.enable_bring_your_own_ad_app ? 0 : 1 + name = "aad-client-id" - value = module.ad_application.id + value = var.enable_bring_your_own_ad_app ? "" : module.ad_application.id key_vault_id = module.keyvault.keyvault_id } diff --git a/infra/templates/osdu-r3-mvp/central_resources/tests/unit/unit_test.go b/infra/templates/osdu-r3-mvp/central_resources/tests/unit/unit_test.go index c89d74055340330d9f9da626a85a1689fd8d5364..93e09535b7962055d21d97d09b3ed38212631c8c 100644 --- a/infra/templates/osdu-r3-mvp/central_resources/tests/unit/unit_test.go +++ b/infra/templates/osdu-r3-mvp/central_resources/tests/unit/unit_test.go @@ -49,7 +49,7 @@ func TestTemplate(t *testing.T) { TfOptions: tfOptions, Workspace: workspace, PlanAssertions: nil, - ExpectedResourceCount: 58, + ExpectedResourceCount: 54, ExpectedResourceAttributeValues: resourceDescription, } diff --git a/infra/templates/osdu-r3-mvp/central_resources/variables.tf b/infra/templates/osdu-r3-mvp/central_resources/variables.tf index f700c0f504ea0fc9bfc1defac051b8c40590d3c4..ce27c62034ba4c75eef4f6f506055ab5d5f9f448 100644 --- a/infra/templates/osdu-r3-mvp/central_resources/variables.tf +++ b/infra/templates/osdu-r3-mvp/central_resources/variables.tf @@ -40,6 +40,12 @@ variable "feature_flag" { } } +variable "enable_bring_your_own_ad_app" { + description = "Feature flag for BYOA" + default = true + type = bool +} + variable "randomization_level" { description = "Number of additional random characters to include in resource names to insulate against unexpected resource name collisions." type = number