diff --git a/released/discovery_center/mission_3945/README.md b/released/discovery_center/mission_3945/README.md index f934fded..3ed19332 100644 --- a/released/discovery_center/mission_3945/README.md +++ b/released/discovery_center/mission_3945/README.md @@ -20,7 +20,7 @@ To deploy the resources you must: $env:BTP_PASSWORD= ``` -2. Change the variables in the `samples.tfvars` file to meet your requirements +2. Change the variables in the `sample.tfvars` file to meet your requirements > ⚠ NOTE: You should pay attention **specifically** to the users defined in the samples.tfvars whether they already exist in your SAP BTP accounts. Otherwise you might get error messages like e.g. `Error: The user could not be found: jane.doe@test.com`. @@ -34,13 +34,13 @@ To deploy the resources you must: 4. You can check what Terraform plans to apply based on your configuration: ```bash - terraform plan -var-file="samples.tfvars" + terraform plan -var-file="sample.tfvars" ``` 5. Apply your configuration to provision the resources: ```bash - terraform apply -var-file="samples.tfvars" + terraform apply -var-file="sample.tfvars" ``` ## In the end diff --git a/released/discovery_center/mission_3945/locals.tf b/released/discovery_center/mission_3945/locals.tf deleted file mode 100644 index a1622f7d..00000000 --- a/released/discovery_center/mission_3945/locals.tf +++ /dev/null @@ -1,3 +0,0 @@ -locals { - service_name__sap_analytics_cloud = "analytics-planning-osb" -} \ No newline at end of file diff --git a/released/discovery_center/mission_3945/main.tf b/released/discovery_center/mission_3945/main.tf index 5f359621..0b93d3a8 100644 --- a/released/discovery_center/mission_3945/main.tf +++ b/released/discovery_center/mission_3945/main.tf @@ -8,6 +8,10 @@ locals { subaccount_domain = lower(replace("mission-3945-${local.random_uuid}", "_", "-")) } +locals { + service_name__sap_analytics_cloud = "analytics-planning-osb" +} + # ------------------------------------------------------------------------------------------------------ # Creation of subaccount # ------------------------------------------------------------------------------------------------------ @@ -33,6 +37,11 @@ resource "btp_subaccount_trust_configuration" "fully_customized" { identity_provider = var.custom_idp } +locals { + custom_idp_tenant = var.custom_idp != "" ? element(split(".", var.custom_idp), 0) : "" + origin_key = local.custom_idp_tenant != "" ? "${local.custom_idp_tenant}-platform" : "sap.default" + origin_key_app_users = var.custom_idp != "" ? var.custom_idp_apps_origin_key : "sap.default" +} # ------------------------------------------------------------------------------------------------------ # Assignment of users as sub account administrators @@ -41,6 +50,7 @@ resource "btp_subaccount_role_collection_assignment" "subaccount-admins" { for_each = toset(var.subaccount_admins) subaccount_id = data.btp_subaccount.dc_mission.id role_collection_name = "Subaccount Administrator" + origin = local.origin_key user_name = each.value } @@ -51,6 +61,7 @@ resource "btp_subaccount_role_collection_assignment" "subaccount-service-admins" for_each = toset(var.subaccount_service_admins) subaccount_id = data.btp_subaccount.dc_mission.id role_collection_name = "Subaccount Service Administrator" + origin = local.origin_key user_name = each.value } diff --git a/released/discovery_center/mission_3945/outputs.tf b/released/discovery_center/mission_3945/outputs.tf index a7f92a50..c0960fb8 100644 --- a/released/discovery_center/mission_3945/outputs.tf +++ b/released/discovery_center/mission_3945/outputs.tf @@ -2,3 +2,7 @@ output "subaccount_id" { value = data.btp_subaccount.dc_mission.id description = "The ID of the subaccount." } + +output "sac_instance_dashboard_url" { + value = btp_subaccount_service_instance.sac.dashboard_url +} diff --git a/released/discovery_center/mission_3945/provider.tf b/released/discovery_center/mission_3945/provider.tf index fb9b04e0..29e1fdd8 100644 --- a/released/discovery_center/mission_3945/provider.tf +++ b/released/discovery_center/mission_3945/provider.tf @@ -3,7 +3,7 @@ terraform { required_providers { btp = { source = "sap/btp" - version = "~> 1.5.0" + version = "~> 1.6.0" } } } diff --git a/released/discovery_center/mission_3945/sample.tfvars b/released/discovery_center/mission_3945/sample.tfvars index bac52085..ba573569 100644 --- a/released/discovery_center/mission_3945/sample.tfvars +++ b/released/discovery_center/mission_3945/sample.tfvars @@ -2,11 +2,10 @@ # Provider configuration # ------------------------------------------------------------------------------------------------------ # Your global account subdomain -globalaccount = "youraccount" -region = "us10" -subaccount_name = "SAP Discovery Center Mission 3945" -cf_environment_label = "cf-us10" -cf_space_name = "dev" +globalaccount = "youraccount" +region = "us10" +subaccount_name = "SAP Discovery Center Mission 3945" +custom_idp = ".accounts.ondemand.com" # ------------------------------------------------------------------------------------------------------ # Project specific configuration (please adapt!) diff --git a/released/discovery_center/mission_3945/variables.tf b/released/discovery_center/mission_3945/variables.tf index 88dacd45..f1963485 100644 --- a/released/discovery_center/mission_3945/variables.tf +++ b/released/discovery_center/mission_3945/variables.tf @@ -41,16 +41,20 @@ variable "custom_idp" { default = "" } +variable "custom_idp_apps_origin_key" { + type = string + description = "The custom identity provider for the subaccount." + default = "sap.custom" +} + variable "subaccount_admins" { type = list(string) description = "Defines the colleagues who are added to each subaccount as subaccount administrators." - default = ["jane.doe@test.com", "john.doe@test.com"] } variable "subaccount_service_admins" { type = list(string) description = "Defines the colleagues who are added to each subaccount as subaccount service administrators." - default = ["jane.doe@test.com", "john.doe@test.com"] } # service plan sap analytics cloud