Skip to content

Commit 0216139

Browse files
authored
3260: Polishing the QAS enabled Mission (#306)
- polished code to be consistent with other QAS missions (like 4024 or 3585)
1 parent d6de43d commit 0216139

File tree

6 files changed

+90
-91
lines changed

6 files changed

+90
-91
lines changed

released/discovery_center/mission_3260/locals.tf

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# ------------------------------------------------------------------------------------------------------
2-
# Setup of names in accordance to naming convention
2+
# Subaccount setup for DC mission 3260
33
# ------------------------------------------------------------------------------------------------------
4+
# Setup subaccount domain (to ensure uniqueness in BTP global account)
45
resource "random_uuid" "uuid" {}
56

67
locals {
@@ -15,13 +16,13 @@ resource "btp_subaccount" "dc_mission" {
1516
count = var.subaccount_id == "" ? 1 : 0
1617
name = var.subaccount_name
1718
subdomain = local.subaccount_domain
18-
region = lower(var.region)
19-
usage = "USED_FOR_PRODUCTION"
19+
region = var.region
2020
}
2121

2222
data "btp_subaccount" "dc_mission" {
2323
id = var.subaccount_id != "" ? var.subaccount_id : btp_subaccount.dc_mission[0].id
2424
}
25+
2526
# ------------------------------------------------------------------------------------------------------
2627
# Assign custom IDP to sub account (if custom_idp is set)
2728
# ------------------------------------------------------------------------------------------------------
@@ -33,49 +34,54 @@ resource "btp_subaccount_trust_configuration" "fully_customized" {
3334
}
3435

3536
# ------------------------------------------------------------------------------------------------------
36-
# Assignment of users as sub account administrators
37+
# APP SUBSCRIPTIONS
3738
# ------------------------------------------------------------------------------------------------------
38-
resource "btp_subaccount_role_collection_assignment" "subaccount-admins" {
39-
for_each = toset(var.subaccount_admins)
40-
subaccount_id = data.btp_subaccount.dc_mission.id
41-
role_collection_name = "Subaccount Administrator"
42-
user_name = each.value
43-
}
44-
45-
# ------------------------------------------------------------------------------------------------------
46-
# Assignment of users as sub account service administrators
47-
# ------------------------------------------------------------------------------------------------------
48-
resource "btp_subaccount_role_collection_assignment" "subaccount-service-admins" {
49-
for_each = toset(var.subaccount_service_admins)
50-
subaccount_id = data.btp_subaccount.dc_mission.id
51-
role_collection_name = "Subaccount Service Administrator"
52-
user_name = each.value
39+
#
40+
locals {
41+
service_name__sap_process_automation = "process-automation"
5342
}
54-
5543
# ------------------------------------------------------------------------------------------------------
56-
# Add Entitlement & Create Subscription - SAP Build Process Automation service
44+
# Setup process-automation (SAP Build Process Automation)
5745
# ------------------------------------------------------------------------------------------------------
58-
59-
# Add Entitlement
46+
# Entitle
6047
resource "btp_subaccount_entitlement" "build_process_automation" {
6148
subaccount_id = data.btp_subaccount.dc_mission.id
6249
service_name = local.service_name__sap_process_automation
6350
plan_name = var.service_plan__sap_process_automation
6451
}
65-
66-
# Create app subscription to SAP Build Process Automation
52+
# Subscribe
6753
resource "btp_subaccount_subscription" "build_process_automation" {
6854
subaccount_id = data.btp_subaccount.dc_mission.id
6955
app_name = local.service_name__sap_process_automation
7056
plan_name = var.service_plan__sap_process_automation
7157
depends_on = [btp_subaccount_entitlement.build_process_automation]
7258
}
59+
# ------------------------------------------------------------------------------------------------------
60+
# USERS AND ROLES
61+
# ------------------------------------------------------------------------------------------------------
62+
# ------------------------------------------------------------------------------------------------------
63+
# Assign role collection "Subaccount Administrator"
64+
# ------------------------------------------------------------------------------------------------------
65+
resource "btp_subaccount_role_collection_assignment" "subaccount_admins" {
66+
for_each = toset(var.subaccount_admins)
67+
subaccount_id = data.btp_subaccount.dc_mission.id
68+
role_collection_name = "Subaccount Administrator"
69+
user_name = each.value
70+
}
7371

7472
# ------------------------------------------------------------------------------------------------------
75-
# Assign Roles - SAP Build Process Automation service
73+
# Assign role collection "Subaccount Service Administrator"
7674
# ------------------------------------------------------------------------------------------------------
75+
resource "btp_subaccount_role_collection_assignment" "subaccount_service_admins" {
76+
for_each = toset(var.subaccount_service_admins)
77+
subaccount_id = data.btp_subaccount.dc_mission.id
78+
role_collection_name = "Subaccount Service Administrator"
79+
user_name = each.value
80+
}
7781

78-
# Assign users to Role Collection: ProcessAutomationAdmin
82+
# ------------------------------------------------------------------------------------------------------
83+
# Assign role collection "ProcessAutomationAdmin"
84+
# ------------------------------------------------------------------------------------------------------
7985
resource "btp_subaccount_role_collection_assignment" "bpa_admins" {
8086
depends_on = [btp_subaccount_subscription.build_process_automation]
8187
for_each = toset(var.process_automation_admins)
@@ -84,18 +90,24 @@ resource "btp_subaccount_role_collection_assignment" "bpa_admins" {
8490
user_name = each.value
8591
}
8692

87-
resource "btp_subaccount_role_collection_assignment" "sbpa_participants" {
93+
# ------------------------------------------------------------------------------------------------------
94+
# Assign role collection "ProcessAutomationDeveloper"
95+
# ------------------------------------------------------------------------------------------------------
96+
resource "btp_subaccount_role_collection_assignment" "sbpa_developers" {
8897
depends_on = [btp_subaccount_subscription.build_process_automation]
89-
for_each = toset(var.process_automation_participants)
98+
for_each = toset(var.process_automation_developers)
9099
subaccount_id = data.btp_subaccount.dc_mission.id
91-
role_collection_name = "ProcessAutomationParticipant"
100+
role_collection_name = "ProcessAutomationDeveloper"
92101
user_name = each.value
93102
}
94103

95-
resource "btp_subaccount_role_collection_assignment" "sbpa_developers" {
104+
# ------------------------------------------------------------------------------------------------------
105+
# Assign role collection "ProcessAutomationParticipant"
106+
# ------------------------------------------------------------------------------------------------------
107+
resource "btp_subaccount_role_collection_assignment" "sbpa_participants" {
96108
depends_on = [btp_subaccount_subscription.build_process_automation]
97-
for_each = toset(var.process_automation_developers)
109+
for_each = toset(var.process_automation_participants)
98110
subaccount_id = data.btp_subaccount.dc_mission.id
99-
role_collection_name = "ProcessAutomationDeveloper"
111+
role_collection_name = "ProcessAutomationParticipant"
100112
user_name = each.value
101113
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
output "subaccount_id" {
22
value = data.btp_subaccount.dc_mission.id
3-
description = "The ID of the subaccount."
3+
description = "The ID of the dc mission subaccount."
44
}
55

6-
output "bpa_url" {
6+
output "process_automation_subscription_url" {
77
value = btp_subaccount_subscription.build_process_automation.subscription_url
8-
description = "Subscription URL for SAP Business Process Automation"
8+
description = "Subscription URL for SAP Build Process Automation"
99
}
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
21
terraform {
32
required_providers {
43
btp = {
5-
source = "sap/btp"
4+
source = "SAP/btp"
65
version = "~> 1.5.0"
76
}
87
}
98
}
109

11-
# Please checkout documentation on how best to authenticate against SAP BTP
12-
# via the Terraform provider for SAP BTP
1310
provider "btp" {
14-
globalaccount = var.globalaccount
1511
cli_server_url = var.cli_server_url
16-
}
12+
globalaccount = var.globalaccount
13+
}
Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
# ------------------------------------------------------------------------------------------------------
2-
# Provider configuration
2+
# Account settings
33
# ------------------------------------------------------------------------------------------------------
4-
# Your global account subdomain
5-
globalaccount = "youraccount"
6-
region = "us10"
7-
subaccount_name = "Discovery Center mission 3260 - Process and approve your invoices with SAP Build Process Automation"
8-
9-
service_plan__sap_process_automation = "free"
4+
globalaccount = "<your-global-account-subdomain>"
5+
region = "us10"
106

117
# ------------------------------------------------------------------------------------------------------
12-
# Project specific configuration (please adapt!)
8+
# Use case specific configuration (please adapt!)
139
# ------------------------------------------------------------------------------------------------------
1410
# Don't add the user, that is executing the TF script to subaccount_admins or subaccount_service_admins!
1511
subaccount_admins = ["[email protected]", "[email protected]"]
1612
subaccount_service_admins = ["[email protected]", "[email protected]"]
1713

1814
process_automation_admins = ["[email protected]", "[email protected]"]
1915
process_automation_developers = ["[email protected]", "[email protected]"]
20-
process_automation_participants = ["[email protected]", "[email protected]"]
21-
16+
process_automation_participants = ["[email protected]", "[email protected]"]

released/discovery_center/mission_3260/variables.tf

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,71 @@
1-
######################################################################
2-
# Customer account setup
3-
######################################################################
4-
# subaccount
1+
# ------------------------------------------------------------------------------------------------------
2+
# Account variables
3+
# ------------------------------------------------------------------------------------------------------
54
variable "globalaccount" {
65
type = string
7-
description = "The globalaccount subdomain."
8-
default = "yourglobalaccount"
9-
}
10-
# subaccount
11-
variable "subaccount_name" {
12-
type = string
13-
description = "The subaccount name."
14-
default = "DC Mission 3260 - Process and approve your invoices with SAP Build Process Automation"
15-
}
16-
17-
# subaccount id
18-
variable "subaccount_id" {
19-
type = string
20-
description = "The subaccount ID."
21-
default = ""
6+
description = "The globalaccount subdomain where the sub account shall be created."
227
}
238

249
variable "cli_server_url" {
2510
type = string
26-
description = "Defines the CLI server URL"
11+
description = "The BTP CLI server URL."
2712
default = "https://cli.btp.cloud.sap"
2813
}
2914

3015
variable "custom_idp" {
3116
type = string
32-
description = "Defines the custom IdP"
17+
description = "The custom identity provider for the subaccount."
3318
default = ""
3419
}
3520

36-
# Region
3721
variable "region" {
3822
type = string
39-
description = "The region where the project account shall be created in."
23+
description = "The region where the subaccount shall be created in."
4024
default = "us10"
4125
}
4226

43-
variable "subaccount_admins" {
44-
type = list(string)
45-
description = "Defines the colleagues who are added to each subaccount as subaccount administrators."
46-
27+
variable "subaccount_name" {
28+
type = string
29+
description = "The subaccount name."
30+
default = "My SAP DC mission subaccount."
4731
}
4832

49-
variable "subaccount_service_admins" {
50-
type = list(string)
51-
description = "Defines the colleagues who are added to each subaccount as subaccount service administrators."
52-
33+
variable "subaccount_id" {
34+
type = string
35+
description = "The subaccount ID."
36+
default = ""
5337
}
5438

55-
56-
# Process automation Variables
39+
# ------------------------------------------------------------------------------------------------------
40+
# app subscription plans
41+
# ------------------------------------------------------------------------------------------------------
5742
variable "service_plan__sap_process_automation" {
5843
type = string
59-
description = "The plan for SAP Build Process Automation"
60-
default = "standard"
44+
description = "The plan for service 'SAP Build Process Automation' with technical name 'process-automation'"
45+
default = "free"
6146

6247
validation {
6348
condition = contains(["standard", "free"], var.service_plan__sap_process_automation)
6449
error_message = "Invalid value for service_plan__sap_process_automation. Only 'standard' and 'free' are allowed."
6550
}
6651
}
6752

53+
# ------------------------------------------------------------------------------------------------------
54+
# User lists
55+
# ------------------------------------------------------------------------------------------------------
56+
variable "subaccount_admins" {
57+
type = list(string)
58+
description = "Defines the users who are added to subaccount as administrators."
59+
}
60+
61+
variable "subaccount_service_admins" {
62+
type = list(string)
63+
description = "Defines the users who are added to subaccount as service administrators."
64+
}
65+
6866
variable "process_automation_admins" {
6967
type = list(string)
70-
description = "Defines the users who have the role of ProcessAutomationAdmin in SAP Build Process Automation"
68+
description = "Defines the users who have the role of 'ProcessAutomationAdmin' in SAP Build Process Automation."
7169
}
7270

7371
variable "process_automation_developers" {

0 commit comments

Comments
 (0)