Skip to content

Dcmission 3260 fix #250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 43 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
87be52f
uc: events to business action
mahesh0431 Sep 10, 2023
839b422
Added Readme - UC - Events to Business Actions
mahesh0431 Sep 10, 2023
78211fe
Added the environment variables documentation
mahesh0431 Sep 10, 2023
bab3bee
documentation
mahesh0431 Sep 28, 2023
59b2047
Update provider.tf
rui1610 Oct 4, 2023
44ae93f
Update terraform.tfvars
rui1610 Oct 4, 2023
4e5b1fe
Merge branch 'main' of https://github.com/SAP-samples/btp-terraform-s…
mahesh0431 Oct 5, 2023
1c50fd0
new structure and btp provider changes
mahesh0431 Oct 6, 2023
3de3460
docu update
mahesh0431 Oct 6, 2023
26f27a2
removed .vscode folder
mahesh0431 Oct 6, 2023
f2bb479
readme update for dcmission 4172
mahesh0431 Oct 6, 2023
1f0bb8c
mission 4356
mahesh0431 Oct 9, 2023
f798413
Merge branch 'SAP-samples:main' into main
mahesh0431 Oct 15, 2023
4d7a739
DC Mission 4033 and updates to 4172 - AEM
mahesh0431 Oct 18, 2023
e47651a
cf space creation removed
mahesh0431 Oct 19, 2023
64eea9a
DC Missions - 4033,4172,4356 restructuring
mahesh0431 Oct 20, 2023
be23d0d
formatting
mahesh0431 Oct 20, 2023
b3bac56
dependencies update
mahesh0431 Oct 23, 2023
d320802
Merge branch 'main' of https://github.com/mahesh0431/btp-terraform-sa…
mahesh0431 Oct 28, 2023
a5faa05
4033 4356
mahesh0431 Jul 2, 2024
f39d743
4033 and 4356
mahesh0431 Jul 2, 2024
304b6d7
Merge branch 'main' of https://github.com/mahesh0431/btp-terraform-sa…
mahesh0431 Jul 2, 2024
16b8cb8
4033 and 4356
mahesh0431 Jul 2, 2024
c11a007
update variables
rui1610 Jul 2, 2024
4db86c8
rename folders
rui1610 Jul 2, 2024
9983ae0
4172 changes
mahesh0431 Jul 2, 2024
6008b6f
3501 changes
mahesh0431 Jul 3, 2024
35b3ad3
Merge pull request #1 from rui1610/main
mahesh0431 Jul 4, 2024
05e6378
fixes variables
mahesh0431 Jul 4, 2024
0fc1880
Merge branch 'SAP-samples:main' into main
mahesh0431 Jul 4, 2024
bcd9d19
formatting
mahesh0431 Jul 4, 2024
9cbda42
Merge branch 'main' of https://github.com/mahesh0431/btp-terraform-sa…
mahesh0431 Jul 4, 2024
7f63f8a
Merge branch 'main' into main
rui1610 Jul 9, 2024
425921d
Merge branch 'SAP-samples:main' into main
mahesh0431 Jul 9, 2024
1183d88
Merge branch 'SAP-samples:main' into main
mahesh0431 Jul 10, 2024
ceeefbc
DC Mission 3260 - QAS-compatible script and README update
mahesh0431 Jul 10, 2024
dd39f2d
fix variables read
mahesh0431 Jul 10, 2024
57ca854
Merge branch 'main' into main
rui1610 Jul 10, 2024
4bfcb1c
fix issues after merging
rui1610 Jul 10, 2024
a0bceda
update formating
rui1610 Jul 10, 2024
5ec3934
Merge branch 'SAP-samples:main' into main
mahesh0431 Jul 10, 2024
c25d14e
dcmission 3260 fixes
mahesh0431 Jul 10, 2024
bc94b32
Merge branch 'main' into dcmission_3260
rui1610 Jul 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 9 additions & 47 deletions released/discovery_center/mission_3260/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

# ------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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]
}
}
8 changes: 1 addition & 7 deletions released/discovery_center/mission_3260/outputs.tf
Original file line number Diff line number Diff line change
@@ -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"
}
21 changes: 0 additions & 21 deletions released/discovery_center/mission_3260/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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"]
}