@@ -63,54 +63,14 @@ resource "btp_subaccount_role_collection_assignment" "subaccount-admins" {
63
63
user_name = each. value
64
64
}
65
65
# #####################################################################
66
- # Add entitlement for BAS, Subscribe BAS and add roles
67
- # #####################################################################
68
- resource "btp_subaccount_entitlement" "bas" {
69
- subaccount_id = btp_subaccount. project . id
70
- service_name = " sapappstudio"
71
- plan_name = var. service_plan__bas
72
- }
73
- resource "btp_subaccount_subscription" "bas-subscribe" {
74
- subaccount_id = btp_subaccount. project . id
75
- app_name = " sapappstudio"
76
- plan_name = var. service_plan__bas
77
- depends_on = [btp_subaccount_entitlement . bas ]
78
- }
79
- resource "btp_subaccount_role_collection_assignment" "Business_Application_Studio_Administrator" {
80
- subaccount_id = btp_subaccount. project . id
81
- role_collection_name = " Business_Application_Studio_Administrator"
82
- user_name = data. btp_whoami . me . email
83
- depends_on = [btp_subaccount_subscription . bas-subscribe ]
84
- }
85
-
86
-
87
- resource "btp_subaccount_role_collection_assignment" "Business_Application_Studio_Developer" {
88
- subaccount_id = btp_subaccount. project . id
89
- role_collection_name = " Business_Application_Studio_Developer"
90
- user_name = data. btp_whoami . me . email
91
- depends_on = [btp_subaccount_subscription . bas-subscribe ]
92
- }
93
- # #####################################################################
94
- # Add Build Workzone entitlement subscription and role Assignment
66
+ # Add Build Workzone entitlement
95
67
# #####################################################################
96
68
resource "btp_subaccount_entitlement" "build_workzone" {
97
69
subaccount_id = btp_subaccount. project . id
98
70
service_name = " SAPLaunchpad"
99
71
plan_name = var. service_plan__build_workzone
100
72
amount = var. service_plan__build_workzone == " free" ? 1 : null
101
73
}
102
- resource "btp_subaccount_subscription" "build_workzone_subscribe" {
103
- subaccount_id = btp_subaccount. project . id
104
- app_name = " SAPLaunchpad"
105
- plan_name = var. service_plan__build_workzone
106
- depends_on = [btp_subaccount_entitlement . build_workzone ]
107
- }
108
- resource "btp_subaccount_role_collection_assignment" "launchpad_admin" {
109
- subaccount_id = btp_subaccount. project . id
110
- role_collection_name = " Launchpad_Admin"
111
- user_name = data. btp_whoami . me . email
112
- depends_on = [btp_subaccount_subscription . build_workzone_subscribe ]
113
- }
114
74
# #####################################################################
115
75
# Create HANA entitlement subscription
116
76
# #####################################################################
@@ -131,12 +91,30 @@ resource "btp_subaccount_subscription" "hana-cloud-tools" {
131
91
plan_name = " tools"
132
92
depends_on = [btp_subaccount_entitlement . hana-cloud-tools ]
133
93
}
94
+ # Assign users to Role Collection: SAP HANA Cloud Administrator
95
+ resource "btp_subaccount_role_collection_assignment" "hana-cloud-admin" {
96
+ for_each = toset (var. hana_cloud_admins )
97
+ subaccount_id = btp_subaccount. project . id
98
+ role_collection_name = " SAP HANA Cloud Administrator"
99
+ user_name = each. value
100
+ depends_on = [btp_subaccount_subscription . hana-cloud-tools ]
101
+ }
134
102
resource "btp_subaccount_entitlement" "hana-hdi-shared" {
135
103
subaccount_id = btp_subaccount. project . id
136
104
service_name = " hana"
137
105
plan_name = " hdi-shared"
138
106
}
139
107
108
+ # ##############################################################################################
109
+ # Prepare and setup app: Continuous Integration & Delivery
110
+ # ##############################################################################################
111
+ # Entitle subaccount for usage of app Continuous Integration & Delivery
112
+ resource "btp_subaccount_entitlement" "cicd_app" {
113
+ subaccount_id = btp_subaccount. project . id
114
+ service_name = " cicd-app"
115
+ plan_name = var. cicd_service_plan
116
+ }
117
+
140
118
locals {
141
119
cf_org_users = setsubtract (toset (var. cf_org_users ), [data . btp_whoami . me . email ])
142
120
cf_org_admins = setsubtract (toset (var. cf_org_admins ), [data . btp_whoami . me . email ])
@@ -147,12 +125,12 @@ resource "local_file" "output_vars_step1" {
147
125
content = <<- EOT
148
126
cf_api_url = "${ jsondecode (btp_subaccount_environment_instance. cloudfoundry . labels )[" API Endpoint" ]} "
149
127
cf_org_id = "${ btp_subaccount_environment_instance . cloudfoundry . platform_id } "
150
-
128
+
151
129
cf_org_users = ${ jsonencode (local. cf_org_users )}
152
130
cf_org_admins = ${ jsonencode (local. cf_org_admins )}
153
131
cf_space_developers = ${ jsonencode (var. cf_space_developers )}
154
132
cf_space_managers = ${ jsonencode (var. cf_space_managers )}
155
133
156
134
EOT
157
135
filename = " ../step2_cf/terraform.tfvars"
158
- }
136
+ }
0 commit comments