diff --git a/released/discovery_center/mission_3260/main.tf b/released/discovery_center/mission_3260/main.tf index ca5daa2a..e5457382 100644 --- a/released/discovery_center/mission_3260/main.tf +++ b/released/discovery_center/mission_3260/main.tf @@ -6,7 +6,6 @@ resource "random_uuid" "uuid" {} locals { random_uuid = random_uuid.uuid.result subaccount_domain = lower(replace("mission-3260-${local.random_uuid}", "_", "-")) - subaccount_cf_org = length(var.cf_org_name) > 0 ? var.cf_org_name : substr(replace("${local.subaccount_domain}", "-", ""), 0, 32) } # ------------------------------------------------------------------------------------------------------ @@ -53,37 +52,11 @@ resource "btp_subaccount_role_collection_assignment" "subaccount-service-admins" user_name = each.value } - -# ------------------------------------------------------------------------------------------------------ -# CLOUDFOUNDRY PREPARATION -# ------------------------------------------------------------------------------------------------------ -# Fetch all available environments for the subaccount -data "btp_subaccount_environments" "all" { - subaccount_id = data.btp_subaccount.dc_mission.id -} # ------------------------------------------------------------------------------------------------------ -# Take the landscape label from the first CF environment if no environment label is provided -# (this replaces the previous null_resource) +# Add Entitlement & Create Subscription - SAP Build Process Automation service # ------------------------------------------------------------------------------------------------------ -resource "terraform_data" "replacement" { - input = length(var.cf_landscape_label) > 0 ? var.cf_landscape_label : [for env in data.btp_subaccount_environments.all.values : env if env.service_name == "cloudfoundry" && env.environment_type == "cloudfoundry"][0].landscape_label -} -resource "btp_subaccount_environment_instance" "cloudfoundry" { - subaccount_id = data.btp_subaccount.dc_mission.id - name = local.subaccount_cf_org - environment_type = "cloudfoundry" - service_name = "cloudfoundry" - plan_name = "standard" - landscape_label = terraform_data.replacement.output - parameters = jsonencode({ - instance_name = local.subaccount_cf_org - }) -} - -# ------------------------------------------------------------------------------------------------------ -# Create service instance - SAP Build Process Automation service -# ------------------------------------------------------------------------------------------------------ +# Add Entitlement resource "btp_subaccount_entitlement" "build_process_automation" { subaccount_id = data.btp_subaccount.dc_mission.id service_name = local.service_name__sap_process_automation @@ -98,8 +71,13 @@ resource "btp_subaccount_subscription" "build_process_automation" { depends_on = [btp_subaccount_entitlement.build_process_automation] } +# ------------------------------------------------------------------------------------------------------ +# Assign Roles - SAP Build Process Automation service +# ------------------------------------------------------------------------------------------------------ + # Assign users to Role Collection: ProcessAutomationAdmin -resource "btp_subaccount_role_collection_assignment" "bpa_admin" { +resource "btp_subaccount_role_collection_assignment" "bpa_admins" { + depends_on = [btp_subaccount_subscription.build_process_automation] for_each = toset(var.process_automation_admins) subaccount_id = data.btp_subaccount.dc_mission.id role_collection_name = "ProcessAutomationAdmin" @@ -120,20 +98,4 @@ resource "btp_subaccount_role_collection_assignment" "sbpa_developers" { subaccount_id = data.btp_subaccount.dc_mission.id role_collection_name = "ProcessAutomationDeveloper" user_name = each.value -} - -# ------------------------------------------------------------------------------------------------------ -# Create service instance - SAP Build Process Automation service -# ------------------------------------------------------------------------------------------------------ -resource "btp_subaccount_entitlement" "bpa" { - subaccount_id = data.btp_subaccount.dc_mission.id - service_name = "process-automation" - plan_name = "free" -} - -resource "btp_subaccount_subscription" "bpa" { - subaccount_id = data.btp_subaccount.dc_mission.id - app_name = "process-automation" - plan_name = "free" - depends_on = [btp_subaccount_entitlement.bpa] -} +} \ No newline at end of file diff --git a/released/discovery_center/mission_3260/outputs.tf b/released/discovery_center/mission_3260/outputs.tf index dac77df7..3d2c3c3c 100644 --- a/released/discovery_center/mission_3260/outputs.tf +++ b/released/discovery_center/mission_3260/outputs.tf @@ -1,15 +1,9 @@ output "subaccount_id" { - value = data.btp_subaccount.dc_mission.id description = "The ID of the subaccount." } -output "cf_org_id" { - value = jsondecode(btp_subaccount_environment_instance.cloudfoundry.labels)["Org ID"] - description = "The Cloudfoundry org ID." -} - output "bpa_url" { - value = btp_subaccount_subscription.bpa.subscription_url + value = btp_subaccount_subscription.build_process_automation.subscription_url description = "Subscription URL for SAP Business Process Automation" } diff --git a/released/discovery_center/mission_3260/variables.tf b/released/discovery_center/mission_3260/variables.tf index ca541c29..148d7bc3 100644 --- a/released/discovery_center/mission_3260/variables.tf +++ b/released/discovery_center/mission_3260/variables.tf @@ -40,19 +40,6 @@ variable "region" { default = "us10" } -variable "cf_org_name" { - type = string - description = "The Cloud Foundry Org name from the Cloud Foundry environment instance." - default = "" -} - -# Cloudfoundry environment label -variable "cf_landscape_label" { - type = string - description = "In case there are multiple environments available for a subaccount, you can use this label to choose with which one you want to go. If nothing is given, we take by default the first available." - default = "" -} - variable "subaccount_admins" { type = list(string) description = "Defines the colleagues who are added to each subaccount as subaccount administrators." @@ -93,11 +80,3 @@ variable "process_automation_participants" { description = "Defines the users who have the role of ProcessAutomationParticipant in SAP Build Process Automation" default = ["jane.doe@test.com", "john.doe@test.com"] } - - -variable "business_process_automation_admins" { - type = list(string) - description = "Defines the colleagues who are added as administrators for the SAP Business Process Automation." - default = ["jane.doe@test.com", "john.doe@test.com"] -} -