Skip to content

Commit dfe02f6

Browse files
authored
4024: bug fix and polishing (#302)
- add missing origin in Launchpad_Admin role_collection_assignment - consistency (with 3585) polishing
1 parent 0eea48d commit dfe02f6

File tree

5 files changed

+101
-82
lines changed

5 files changed

+101
-82
lines changed

released/discovery_center/mission_4024/step1/main.tf

Lines changed: 69 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1+
# ------------------------------------------------------------------------------------------------------
2+
# Subaccount setup for DC mission 4024
3+
# ------------------------------------------------------------------------------------------------------
4+
# Setup subaccount domain (to ensure uniqueness in BTP global account)
15
resource "random_uuid" "uuid" {}
26

37
locals {
48
random_uuid = random_uuid.uuid.result
59
subaccount_domain = "dcmission4024${local.random_uuid}"
6-
7-
# used (mandatory) services
8-
service_name__sap_build_apps = "sap-build-apps"
9-
service_name__sap_launchpad = "SAPLaunchpad"
10-
service_name__destination = "destination"
11-
# optional, if custom idp is used
12-
service_name__sap_identity_services_onboarding = "sap-identity-services-onboarding"
1310
}
1411

1512
# ------------------------------------------------------------------------------------------------------
@@ -31,8 +28,66 @@ data "btp_subaccount" "subaccount" {
3128
id = data.btp_subaccount.dc_mission.id
3229
}
3330
# ------------------------------------------------------------------------------------------------------
34-
# SERVICES/SUBSCRIPTIONS
31+
# SERVICES
32+
# ------------------------------------------------------------------------------------------------------
33+
#
34+
locals {
35+
service_name__destination = "destination"
36+
}
37+
# ------------------------------------------------------------------------------------------------------
38+
# Setup destination (Destination Service)
39+
# ------------------------------------------------------------------------------------------------------
40+
# Entitle
41+
resource "btp_subaccount_entitlement" "destination" {
42+
subaccount_id = data.btp_subaccount.dc_mission.id
43+
service_name = local.service_name__destination
44+
plan_name = var.service_plan__destination
45+
}
46+
47+
# Get plan for destination service
48+
data "btp_subaccount_service_plan" "by_name" {
49+
subaccount_id = data.btp_subaccount.dc_mission.id
50+
name = var.service_plan__destination
51+
offering_name = local.service_name__destination
52+
depends_on = [btp_subaccount_subscription.sap_launchpad]
53+
}
54+
55+
# Create destination for Visual Cloud Functions
56+
resource "btp_subaccount_service_instance" "vcf_destination" {
57+
subaccount_id = data.btp_subaccount.dc_mission.id
58+
serviceplan_id = data.btp_subaccount_service_plan.by_name.id
59+
name = "SAP-Build-Apps-Runtime"
60+
parameters = jsonencode({
61+
HTML5Runtime_enabled = true
62+
init_data = {
63+
subaccount = {
64+
existing_destinations_policy = "update"
65+
destinations = [
66+
{
67+
Name = "SAP-Build-Apps-Runtime"
68+
Type = "HTTP"
69+
Description = "Endpoint to SAP Build Apps runtime"
70+
URL = "https://${data.btp_subaccount.subaccount.subdomain}.cr1.${data.btp_subaccount.subaccount.region}.apps.build.cloud.sap/"
71+
ProxyType = "Internet"
72+
Authentication = "NoAuthentication"
73+
"HTML5.ForwardAuthToken" = true
74+
}
75+
]
76+
}
77+
}
78+
})
79+
}
80+
81+
# ------------------------------------------------------------------------------------------------------
82+
# APP SUBSCRIPTIONS
3583
# ------------------------------------------------------------------------------------------------------
84+
#
85+
locals {
86+
service_name__sap_build_apps = "sap-build-apps"
87+
service_name__sap_launchpad = "SAPLaunchpad"
88+
# optional, if custom idp is used
89+
service_name__sap_identity_services_onboarding = "sap-identity-services-onboarding"
90+
}
3691
# ------------------------------------------------------------------------------------------------------
3792
# Setup sap-identity-services-onboarding (Cloud Identity Services)
3893
# ------------------------------------------------------------------------------------------------------
@@ -69,7 +124,7 @@ resource "btp_subaccount_entitlement" "sap_build_apps" {
69124
depends_on = [btp_subaccount_trust_configuration.fully_customized]
70125
}
71126
# Subscribe
72-
resource "btp_subaccount_subscription" "sap-build-apps" {
127+
resource "btp_subaccount_subscription" "sap_build_apps" {
73128
subaccount_id = data.btp_subaccount.dc_mission.id
74129
app_name = "sap-appgyver-ee"
75130
plan_name = var.service_plan__sap_build_apps
@@ -95,58 +150,14 @@ resource "btp_subaccount_subscription" "sap_launchpad" {
95150
depends_on = [btp_subaccount_entitlement.sap_launchpad]
96151
}
97152

98-
# ------------------------------------------------------------------------------------------------------
99-
# Setup destination (Destination Service)
100-
# ------------------------------------------------------------------------------------------------------
101-
# Entitle
102-
resource "btp_subaccount_entitlement" "destination" {
103-
subaccount_id = data.btp_subaccount.dc_mission.id
104-
service_name = local.service_name__destination
105-
plan_name = var.service_plan__destination
106-
}
107-
108-
# Get plan for destination service
109-
data "btp_subaccount_service_plan" "by_name" {
110-
subaccount_id = data.btp_subaccount.dc_mission.id
111-
name = var.service_plan__destination
112-
offering_name = local.service_name__destination
113-
depends_on = [btp_subaccount_subscription.sap_launchpad]
114-
}
115-
116-
# Create destination for Visual Cloud Functions
117-
resource "btp_subaccount_service_instance" "vcf_destination" {
118-
subaccount_id = data.btp_subaccount.dc_mission.id
119-
serviceplan_id = data.btp_subaccount_service_plan.by_name.id
120-
name = "SAP-Build-Apps-Runtime"
121-
parameters = jsonencode({
122-
HTML5Runtime_enabled = true
123-
init_data = {
124-
subaccount = {
125-
existing_destinations_policy = "update"
126-
destinations = [
127-
{
128-
Name = "SAP-Build-Apps-Runtime"
129-
Type = "HTTP"
130-
Description = "Endpoint to SAP Build Apps runtime"
131-
URL = "https://${data.btp_subaccount.subaccount.subdomain}.cr1.${data.btp_subaccount.subaccount.region}.apps.build.cloud.sap/"
132-
ProxyType = "Internet"
133-
Authentication = "NoAuthentication"
134-
"HTML5.ForwardAuthToken" = true
135-
}
136-
]
137-
}
138-
}
139-
})
140-
}
141-
142153
# ------------------------------------------------------------------------------------------------------
143154
# USERS AND ROLES
144155
# ------------------------------------------------------------------------------------------------------
145156
#
146157
# Get all roles in the subaccount
147158
data "btp_subaccount_roles" "all" {
148159
subaccount_id = data.btp_subaccount.dc_mission.id
149-
depends_on = [btp_subaccount_subscription.sap-build-apps]
160+
depends_on = [btp_subaccount_subscription.sap_build_apps]
150161
}
151162
# ------------------------------------------------------------------------------------------------------
152163
# Assign role collection "Subaccount Administrator"
@@ -263,12 +274,16 @@ resource "btp_subaccount_role_collection_assignment" "build_apps_registry_develo
263274
depends_on = [btp_subaccount_role_collection.build_apps_registry_developer]
264275
}
265276

277+
# ------------------------------------------------------------------------------------------------------
278+
# Assign role collection "Launchpad_Admin"
279+
# ------------------------------------------------------------------------------------------------------
266280
# Assign users
267281
resource "btp_subaccount_role_collection_assignment" "launchpad_admin" {
268282
for_each = toset("${var.launchpad_admins}")
269283
subaccount_id = data.btp_subaccount.dc_mission.id
270284
role_collection_name = "Launchpad_Admin"
271285
user_name = each.value
286+
origin = btp_subaccount_trust_configuration.fully_customized.origin
272287
depends_on = [btp_subaccount_subscription.sap_launchpad]
273288
}
274289

released/discovery_center/mission_4024/step1/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ output "subaccount_id" {
44
}
55

66
output "sap_build_apps_subscription_url" {
7-
value = btp_subaccount_subscription.sap-build-apps.subscription_url
7+
value = btp_subaccount_subscription.sap_build_apps.subscription_url
88
description = "The subscription_url of build app."
99
}

released/discovery_center/mission_4024/step1/sample.tfvars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ custom_idp = "<<tenant-id>>.accounts.ondemand.com"
66
# ------------------------------------------------------------------------------------------------------
77
# Account settings
88
# ------------------------------------------------------------------------------------------------------
9-
globalaccount = "your-globalaccount-subdomain"
9+
globalaccount = "<your-global-account-subdomain>"
1010
region = "us10"
1111

1212
# ------------------------------------------------------------------------------------------------------

released/discovery_center/mission_4024/step1/variables.tf

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ variable "globalaccount" {
99
variable "cli_server_url" {
1010
type = string
1111
description = "The BTP CLI server URL."
12-
default = "https://cpcli.cf.eu10.hana.ondemand.com"
12+
default = "https://cli.btp.cloud.sap"
1313
}
1414

1515
variable "custom_idp" {
1616
type = string
17-
description = "Defines the custom IDP to be used for the subaccount"
17+
description = "The custom identity provider for the subaccount."
1818
default = ""
1919
}
2020

2121
variable "region" {
2222
type = string
23-
description = "The region where the sub account shall be created in."
23+
description = "The region where the subaccount shall be created in."
2424
default = "us10"
2525
}
2626

2727
variable "subaccount_name" {
2828
type = string
2929
description = "The subaccount name."
30-
default = "My SAP Build Apps subaccount"
30+
default = "My SAP DC mission subaccount."
3131
}
3232

3333
variable "subaccount_id" {
@@ -39,26 +39,6 @@ variable "subaccount_id" {
3939
# ------------------------------------------------------------------------------------------------------
4040
# service plans
4141
# ------------------------------------------------------------------------------------------------------
42-
variable "service_plan__sap_build_apps" {
43-
type = string
44-
description = "The plan for SAP Build Apps subscription"
45-
default = "free"
46-
validation {
47-
condition = contains(["free", "standard", "partner"], var.service_plan__sap_build_apps)
48-
error_message = "Invalid value for service_plan__sap_build_apps. Only 'free', 'standard' and 'partner' are allowed."
49-
}
50-
}
51-
52-
variable "service_plan__sap_launchpad" {
53-
type = string
54-
description = "The plan for service 'SAP Build Work Zone, standard edition' with technical name 'SAPLaunchpad'"
55-
default = "free"
56-
validation {
57-
condition = contains(["free", "standard"], var.service_plan__sap_launchpad)
58-
error_message = "Invalid value for service_plan__sap_launchpad. Only 'free' and 'standard' are allowed."
59-
}
60-
}
61-
6242
variable "service_plan__destination" {
6343
type = string
6444
description = "The plan for service 'Destination Service' with technical name 'destination'"
@@ -69,6 +49,9 @@ variable "service_plan__destination" {
6949
}
7050
}
7151

52+
# ------------------------------------------------------------------------------------------------------
53+
# app subscription plans
54+
# ------------------------------------------------------------------------------------------------------
7255
variable "service_plan__sap_identity_services_onboarding" {
7356
type = string
7457
description = "The plan for service 'Cloud Identity Services' with technical name 'sap-identity-services-onboarding'"
@@ -79,6 +62,26 @@ variable "service_plan__sap_identity_services_onboarding" {
7962
}
8063
}
8164

65+
variable "service_plan__sap_build_apps" {
66+
type = string
67+
description = "The plan for SAP Build Apps subscription"
68+
default = "free"
69+
validation {
70+
condition = contains(["free", "standard", "partner"], var.service_plan__sap_build_apps)
71+
error_message = "Invalid value for service_plan__sap_build_apps. Only 'free', 'standard' and 'partner' are allowed."
72+
}
73+
}
74+
75+
variable "service_plan__sap_launchpad" {
76+
type = string
77+
description = "The plan for service 'SAP Build Work Zone, standard edition' with technical name 'SAPLaunchpad'"
78+
default = "free"
79+
validation {
80+
condition = contains(["free", "standard"], var.service_plan__sap_launchpad)
81+
error_message = "Invalid value for service_plan__sap_launchpad. Only 'free' and 'standard' are allowed."
82+
}
83+
}
84+
8285
# ------------------------------------------------------------------------------------------------------
8386
# User lists
8487
# ------------------------------------------------------------------------------------------------------
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# ------------------------------------------------------------------------------------------------------
22
# Account settings
33
# ------------------------------------------------------------------------------------------------------
4-
globalaccount = "<<your-global-account-subdomain>>"
5-
subaccount_id = "<<subaccount id from step 1>>"
4+
globalaccount = "<your-global-account-subdomain>"
5+
6+
subaccount_id = "<subaccount id from step 1>>"

0 commit comments

Comments
 (0)