@@ -6,6 +6,7 @@ resource "random_uuid" "uuid" {}
6
6
locals {
7
7
random_uuid = random_uuid. uuid . result
8
8
subaccount_domain = lower (replace (" mission-4033-${ local . random_uuid } " , " _" , " -" ))
9
+ subaccount_cf_org = substr (replace (" ${ local . subaccount_domain } " , " -" , " " ), 0 , 32 )
9
10
}
10
11
11
12
locals {
@@ -128,6 +129,33 @@ resource "btp_subaccount_environment_instance" "kyma" {
128
129
depends_on = [btp_subaccount_entitlement . kymaruntime ]
129
130
}
130
131
132
+ # ------------------------------------------------------------------------------------------------------
133
+ # Extract list of CF landscape labels from environments
134
+ # ------------------------------------------------------------------------------------------------------
135
+ data "btp_subaccount_environments" "all" {
136
+ subaccount_id = data. btp_subaccount . dc_mission . id
137
+ }
138
+
139
+ # Take the landscape label from the first CF environment if no environment label is provided
140
+ resource "terraform_data" "cf_landscape_label" {
141
+ 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
142
+ }
143
+
144
+ # ------------------------------------------------------------------------------------------------------
145
+ # Creation of Cloud Foundry environment
146
+ # ------------------------------------------------------------------------------------------------------
147
+ resource "btp_subaccount_environment_instance" "cloudfoundry" {
148
+ subaccount_id = data. btp_subaccount . dc_mission . id
149
+ name = var. cf_org_name
150
+ environment_type = " cloudfoundry"
151
+ service_name = " cloudfoundry"
152
+ plan_name = " standard"
153
+ landscape_label = terraform_data. cf_landscape_label . output
154
+ parameters = jsonencode ({
155
+ instance_name = local.subaccount_cf_org
156
+ })
157
+ }
158
+
131
159
# ------------------------------------------------------------------------------------------------------
132
160
# Create app subscription to SAP Integration Suite
133
161
# ------------------------------------------------------------------------------------------------------
@@ -230,7 +258,7 @@ resource "btp_subaccount_entitlement" "process_automation_service" {
230
258
depends_on = [btp_subaccount_subscription . build_process_automation ]
231
259
}
232
260
233
- # Get plan for SAP AI Core service
261
+ # Get plan for SAP Build Process Automation service
234
262
data "btp_subaccount_service_plan" "process_automation_service" {
235
263
subaccount_id = data. btp_subaccount . dc_mission . id
236
264
offering_name = local. service_name__sap_process_automation_service
@@ -243,7 +271,7 @@ resource "btp_subaccount_service_instance" "process_automation_service_instance"
243
271
subaccount_id = data. btp_subaccount . dc_mission . id
244
272
serviceplan_id = data. btp_subaccount_service_plan . process_automation_service . id
245
273
name = " build-process-automation-service-instance"
246
- depends_on = [btp_subaccount_entitlement . process_automation_service ]
274
+ depends_on = [btp_subaccount_entitlement . process_automation_service , btp_subaccount_environment_instance . cloudfoundry ]
247
275
}
248
276
249
277
# Create service binding to SAP Build Process Automation Service (exposed for a specific user group)
0 commit comments