1
+ # ------------------------------------------------------------------------------------------------------
2
+ # Subaccount setup for DC mission 4024
3
+ # ------------------------------------------------------------------------------------------------------
4
+ # Setup subaccount domain (to ensure uniqueness in BTP global account)
1
5
resource "random_uuid" "uuid" {}
2
6
3
7
locals {
4
8
random_uuid = random_uuid. uuid . result
5
9
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"
13
10
}
14
11
15
12
# ------------------------------------------------------------------------------------------------------
@@ -31,8 +28,66 @@ data "btp_subaccount" "subaccount" {
31
28
id = data. btp_subaccount . dc_mission . id
32
29
}
33
30
# ------------------------------------------------------------------------------------------------------
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
35
83
# ------------------------------------------------------------------------------------------------------
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
+ }
36
91
# ------------------------------------------------------------------------------------------------------
37
92
# Setup sap-identity-services-onboarding (Cloud Identity Services)
38
93
# ------------------------------------------------------------------------------------------------------
@@ -69,7 +124,7 @@ resource "btp_subaccount_entitlement" "sap_build_apps" {
69
124
depends_on = [btp_subaccount_trust_configuration . fully_customized ]
70
125
}
71
126
# Subscribe
72
- resource "btp_subaccount_subscription" "sap-build-apps " {
127
+ resource "btp_subaccount_subscription" "sap_build_apps " {
73
128
subaccount_id = data. btp_subaccount . dc_mission . id
74
129
app_name = " sap-appgyver-ee"
75
130
plan_name = var. service_plan__sap_build_apps
@@ -95,58 +150,14 @@ resource "btp_subaccount_subscription" "sap_launchpad" {
95
150
depends_on = [btp_subaccount_entitlement . sap_launchpad ]
96
151
}
97
152
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
-
142
153
# ------------------------------------------------------------------------------------------------------
143
154
# USERS AND ROLES
144
155
# ------------------------------------------------------------------------------------------------------
145
156
#
146
157
# Get all roles in the subaccount
147
158
data "btp_subaccount_roles" "all" {
148
159
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 ]
150
161
}
151
162
# ------------------------------------------------------------------------------------------------------
152
163
# Assign role collection "Subaccount Administrator"
@@ -263,12 +274,16 @@ resource "btp_subaccount_role_collection_assignment" "build_apps_registry_develo
263
274
depends_on = [btp_subaccount_role_collection . build_apps_registry_developer ]
264
275
}
265
276
277
+ # ------------------------------------------------------------------------------------------------------
278
+ # Assign role collection "Launchpad_Admin"
279
+ # ------------------------------------------------------------------------------------------------------
266
280
# Assign users
267
281
resource "btp_subaccount_role_collection_assignment" "launchpad_admin" {
268
282
for_each = toset (" ${ var . launchpad_admins } " )
269
283
subaccount_id = data. btp_subaccount . dc_mission . id
270
284
role_collection_name = " Launchpad_Admin"
271
285
user_name = each. value
286
+ origin = btp_subaccount_trust_configuration. fully_customized . origin
272
287
depends_on = [btp_subaccount_subscription . sap_launchpad ]
273
288
}
274
289
0 commit comments