Skip to content

Commit 74ddd8f

Browse files
committed
4024_trial: bug fix and polishing
- add missing origin in Launchpad_Admin role_collection_assignment - add optional (cf) application runtime entitlement - consistency (with 3585) polishing
1 parent 0eea48d commit 74ddd8f

File tree

5 files changed

+137
-85
lines changed

5 files changed

+137
-85
lines changed

released/discovery_center/mission_4024_trial/step1/main.tf

Lines changed: 83 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1+
# ------------------------------------------------------------------------------------------------------
2+
# Subaccount setup for DC mission 4024 (trial)
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,80 @@ data "btp_subaccount" "subaccount" {
3128
id = data.btp_subaccount.dc_mission.id
3229
}
3330
# ------------------------------------------------------------------------------------------------------
34-
# SERVICES/SUBSCRIPTIONS
31+
# SERVICES
3532
# ------------------------------------------------------------------------------------------------------
33+
#
34+
locals {
35+
service_name__destination = "destination"
36+
# optional
37+
service_name__application_runtime = "APPLICATION_RUNTIME"
38+
}
39+
# ------------------------------------------------------------------------------------------------------
40+
# Setup destination (Destination Service)
41+
# ------------------------------------------------------------------------------------------------------
42+
# Entitle
43+
resource "btp_subaccount_entitlement" "destination" {
44+
subaccount_id = data.btp_subaccount.dc_mission.id
45+
service_name = local.service_name__destination
46+
plan_name = var.service_plan__destination
47+
}
48+
49+
# Get plan for destination service
50+
data "btp_subaccount_service_plan" "by_name" {
51+
subaccount_id = data.btp_subaccount.dc_mission.id
52+
name = var.service_plan__destination
53+
offering_name = local.service_name__destination
54+
depends_on = [btp_subaccount_subscription.sap_launchpad]
55+
}
56+
57+
# Create destination for Visual Cloud Functions
58+
resource "btp_subaccount_service_instance" "vcf_destination" {
59+
subaccount_id = data.btp_subaccount.dc_mission.id
60+
serviceplan_id = data.btp_subaccount_service_plan.by_name.id
61+
name = "SAP-Build-Apps-Runtime"
62+
parameters = jsonencode({
63+
HTML5Runtime_enabled = true
64+
init_data = {
65+
subaccount = {
66+
existing_destinations_policy = "update"
67+
destinations = [
68+
{
69+
Name = "SAP-Build-Apps-Runtime"
70+
Type = "HTTP"
71+
Description = "Endpoint to SAP Build Apps runtime"
72+
URL = "https://${data.btp_subaccount.subaccount.subdomain}.cr1.${data.btp_subaccount.subaccount.region}.apps.build.cloud.sap/"
73+
ProxyType = "Internet"
74+
Authentication = "NoAuthentication"
75+
"HTML5.ForwardAuthToken" = true
76+
}
77+
]
78+
}
79+
}
80+
})
81+
}
82+
83+
# ------------------------------------------------------------------------------------------------------
84+
# Setup APPLICATION_RUNTIME (Cloud Foundry Runtime)
85+
# ------------------------------------------------------------------------------------------------------
86+
# Entitle
87+
resource "btp_subaccount_entitlement" "application_runtime" {
88+
count = var.use_optional_resources ? 1 : 0
89+
subaccount_id = data.btp_subaccount.dc_mission.id
90+
service_name = local.service_name__application_runtime
91+
plan_name = var.service_plan__application_runtime
92+
amount = 1
93+
}
94+
95+
# ------------------------------------------------------------------------------------------------------
96+
# APP SUBSCRIPTIONS
97+
# ------------------------------------------------------------------------------------------------------
98+
#
99+
locals {
100+
service_name__sap_build_apps = "sap-build-apps"
101+
service_name__sap_launchpad = "SAPLaunchpad"
102+
# optional, if custom idp is used
103+
service_name__sap_identity_services_onboarding = "sap-identity-services-onboarding"
104+
}
36105
# ------------------------------------------------------------------------------------------------------
37106
# Setup sap-identity-services-onboarding (Cloud Identity Services)
38107
# ------------------------------------------------------------------------------------------------------
@@ -69,7 +138,7 @@ resource "btp_subaccount_entitlement" "sap_build_apps" {
69138
depends_on = [btp_subaccount_trust_configuration.fully_customized]
70139
}
71140
# Subscribe
72-
resource "btp_subaccount_subscription" "sap-build-apps" {
141+
resource "btp_subaccount_subscription" "sap_build_apps" {
73142
subaccount_id = data.btp_subaccount.dc_mission.id
74143
app_name = "sap-appgyver-ee"
75144
plan_name = var.service_plan__sap_build_apps
@@ -84,7 +153,6 @@ resource "btp_subaccount_entitlement" "sap_launchpad" {
84153
subaccount_id = data.btp_subaccount.dc_mission.id
85154
service_name = local.service_name__sap_launchpad
86155
plan_name = var.service_plan__sap_launchpad
87-
#amount = var.service_plan__sap_launchpad == "free" ? 1 : null
88156
}
89157

90158
# Subscribe
@@ -95,58 +163,14 @@ resource "btp_subaccount_subscription" "sap_launchpad" {
95163
depends_on = [btp_subaccount_entitlement.sap_launchpad]
96164
}
97165

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-
142166
# ------------------------------------------------------------------------------------------------------
143167
# USERS AND ROLES
144168
# ------------------------------------------------------------------------------------------------------
145169
#
146170
# Get all roles in the subaccount
147171
data "btp_subaccount_roles" "all" {
148172
subaccount_id = data.btp_subaccount.dc_mission.id
149-
depends_on = [btp_subaccount_subscription.sap-build-apps]
173+
depends_on = [btp_subaccount_subscription.sap_build_apps]
150174
}
151175
# ------------------------------------------------------------------------------------------------------
152176
# Assign role collection "Subaccount Administrator"
@@ -263,12 +287,16 @@ resource "btp_subaccount_role_collection_assignment" "build_apps_registry_develo
263287
depends_on = [btp_subaccount_role_collection.build_apps_registry_developer]
264288
}
265289

290+
# ------------------------------------------------------------------------------------------------------
291+
# Assign role collection "Launchpad_Admin"
292+
# ------------------------------------------------------------------------------------------------------
266293
# Assign users
267294
resource "btp_subaccount_role_collection_assignment" "launchpad_admin" {
268295
for_each = toset("${var.launchpad_admins}")
269296
subaccount_id = data.btp_subaccount.dc_mission.id
270297
role_collection_name = "Launchpad_Admin"
271298
user_name = each.value
299+
origin = btp_subaccount_trust_configuration.fully_customized.origin
272300
depends_on = [btp_subaccount_subscription.sap_launchpad]
273301
}
274302

released/discovery_center/mission_4024_trial/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_trial/step1/sample.tfvars

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
# ------------------------------------------------------------------------------------------------------
22
# Account settings
33
# ------------------------------------------------------------------------------------------------------
4-
globalaccount = "your-globalaccount-subdomain"
5-
region = "us10"
4+
# Your global account subdomain
5+
globalaccount = "<your-globalaccount-subdomain>" // <xxxxxxxx>trial-ga
6+
7+
# Region for your trial subaccount
8+
region = "us10"
9+
10+
subaccount_id = "<your trial Subaccount ID>"
611

712
# ------------------------------------------------------------------------------------------------------
8-
# Use case specific configuration
13+
# Use case specific role assignments
914
# ------------------------------------------------------------------------------------------------------
1015
subaccount_admins = ["[email protected]"]
1116
launchpad_admins = ["[email protected]"]

released/discovery_center/mission_4024_trial/step1/variables.tf

Lines changed: 43 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" {
@@ -36,29 +36,15 @@ variable "subaccount_id" {
3636
default = ""
3737
}
3838

39+
variable "use_optional_resources" {
40+
type = bool
41+
description = "optional resources are ignored if value is false"
42+
default = true
43+
}
44+
3945
# ------------------------------------------------------------------------------------------------------
4046
# service plans
4147
# ------------------------------------------------------------------------------------------------------
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 = "standard"
56-
validation {
57-
condition = contains(["standard"], var.service_plan__sap_launchpad)
58-
error_message = "Invalid value for service_plan__sap_launchpad. Only 'standard' is allowed."
59-
}
60-
}
61-
6248
variable "service_plan__destination" {
6349
type = string
6450
description = "The plan for service 'Destination Service' with technical name 'destination'"
@@ -69,6 +55,19 @@ variable "service_plan__destination" {
6955
}
7056
}
7157

58+
variable "service_plan__application_runtime" {
59+
type = string
60+
description = "The plan for service 'Cloud Foundry Runtime' with technical name 'APPLICATION_RUNTIME'"
61+
default = "MEMORY"
62+
validation {
63+
condition = contains(["MEMORY"], var.service_plan__application_runtime)
64+
error_message = "Invalid value for service_plan__application_runtime. Only 'MEMORY' is allowed."
65+
}
66+
}
67+
68+
# ------------------------------------------------------------------------------------------------------
69+
# app subscription plans
70+
# ------------------------------------------------------------------------------------------------------
7271
variable "service_plan__sap_identity_services_onboarding" {
7372
type = string
7473
description = "The plan for service 'Cloud Identity Services' with technical name 'sap-identity-services-onboarding'"
@@ -79,6 +78,26 @@ variable "service_plan__sap_identity_services_onboarding" {
7978
}
8079
}
8180

81+
variable "service_plan__sap_build_apps" {
82+
type = string
83+
description = "The plan for SAP Build Apps subscription"
84+
default = "free"
85+
validation {
86+
condition = contains(["free", "standard", "partner"], var.service_plan__sap_build_apps)
87+
error_message = "Invalid value for service_plan__sap_build_apps. Only 'free', 'standard' and 'partner' are allowed."
88+
}
89+
}
90+
91+
variable "service_plan__sap_launchpad" {
92+
type = string
93+
description = "The plan for service 'SAP Build Work Zone, standard edition' with technical name 'SAPLaunchpad'"
94+
default = "standard"
95+
validation {
96+
condition = contains(["standard"], var.service_plan__sap_launchpad)
97+
error_message = "Invalid value for service_plan__sap_launchpad. Only 'standard' is allowed."
98+
}
99+
}
100+
82101
# ------------------------------------------------------------------------------------------------------
83102
# User lists
84103
# ------------------------------------------------------------------------------------------------------
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ------------------------------------------------------------------------------------------------------
22
# Account settings
33
# ------------------------------------------------------------------------------------------------------
4-
globalaccount = "<<your-global-account-subdomain>>"
5-
subaccount_id = "<<subaccount id from step 1>>"
4+
globalaccount = "<your-globalaccount-subdomain>" // <xxxxxxxx>trial-ga
5+
subaccount_id = "<your trial Subaccount ID>"

0 commit comments

Comments
 (0)