Skip to content

Commit d08d278

Browse files
committed
chore: Update QAS mission 4327
1 parent 99352a8 commit d08d278

File tree

4 files changed

+44
-61
lines changed

4 files changed

+44
-61
lines changed

released/discovery_center/mission_4327/step1/main.tf

Lines changed: 21 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -63,54 +63,14 @@ resource "btp_subaccount_role_collection_assignment" "subaccount-admins" {
6363
user_name = each.value
6464
}
6565
######################################################################
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
9567
######################################################################
9668
resource "btp_subaccount_entitlement" "build_workzone" {
9769
subaccount_id = btp_subaccount.project.id
9870
service_name = "SAPLaunchpad"
9971
plan_name = var.service_plan__build_workzone
10072
amount = var.service_plan__build_workzone == "free" ? 1 : null
10173
}
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-
}
11474
######################################################################
11575
# Create HANA entitlement subscription
11676
######################################################################
@@ -131,12 +91,30 @@ resource "btp_subaccount_subscription" "hana-cloud-tools" {
13191
plan_name = "tools"
13292
depends_on = [btp_subaccount_entitlement.hana-cloud-tools]
13393
}
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+
}
134102
resource "btp_subaccount_entitlement" "hana-hdi-shared" {
135103
subaccount_id = btp_subaccount.project.id
136104
service_name = "hana"
137105
plan_name = "hdi-shared"
138106
}
139107

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+
140118
locals {
141119
cf_org_users = setsubtract(toset(var.cf_org_users), [data.btp_whoami.me.email])
142120
cf_org_admins = setsubtract(toset(var.cf_org_admins), [data.btp_whoami.me.email])
@@ -147,12 +125,12 @@ resource "local_file" "output_vars_step1" {
147125
content = <<-EOT
148126
cf_api_url = "${jsondecode(btp_subaccount_environment_instance.cloudfoundry.labels)["API Endpoint"]}"
149127
cf_org_id = "${btp_subaccount_environment_instance.cloudfoundry.platform_id}"
150-
128+
151129
cf_org_users = ${jsonencode(local.cf_org_users)}
152130
cf_org_admins = ${jsonencode(local.cf_org_admins)}
153131
cf_space_developers = ${jsonencode(var.cf_space_developers)}
154132
cf_space_managers = ${jsonencode(var.cf_space_managers)}
155133
156134
EOT
157135
filename = "../step2_cf/terraform.tfvars"
158-
}
136+
}

released/discovery_center/mission_4327/step1/outputs.tf

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ output "cf_org_admins" {
2222
value = local.cf_org_admins
2323
}
2424

25-
output "bas_subscription_url" {
26-
value = btp_subaccount_subscription.bas-subscribe.subscription_url
27-
}
28-
29-
output "build_workzone_subscription_url" {
30-
value = btp_subaccount_subscription.build_workzone_subscribe.subscription_url
31-
}
32-
3325
output "hana_cloud_tools_subscription_url" {
3426
value = btp_subaccount_subscription.hana-cloud-tools.subscription_url
35-
}
27+
}

released/discovery_center/mission_4327/step1/samples.tfvars

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Provider configuration
33
# ------------------------------------------------------------------------------------------------------
44
# Your global account subdomain
5-
globalaccount = "myglobalaccount"
5+
globalaccount = "terraformintprod"
66
# ------------------------------------------------------------------------------------------------------
77
# Project specific configuration (please adapt!)
88
# ------------------------------------------------------------------------------------------------------
@@ -15,18 +15,22 @@ subaccount_admins = ["[email protected]", "[email protected]"]
1515
# Entitlements plan update
1616
#------------------------------------------------------------------------------------------------------
1717
# For production use of Business Application Studio, upgrade the plan from the `free-tier` to the appropriate plan e.g standard-edition
18-
service_plan__bas = "standard-edition"
18+
# service_plan__bas = "standard-edition"
1919
#-------------------------------------------------------------------------------------------------------
2020
# For production use of Build Workzone, upgrade the plan from the `free-tier` to the appropriate plan e.g standard
2121
service_plan__build_workzone = "standard"
2222
#--------------------------------------------------------------------------------------------------------
2323
# For production use of HANA, upgrade the plan from the `free-tier` to the appropriate plan e.g hana
2424
service_plan__hana_cloud = "hana"
25+
# cicd service plan
26+
cicd_service_plan = "default"
2527
#------------------------------------------------------------------------------------------------------
2628
# Cloud Foundry
2729
#------------------------------------------------------------------------------------------------------
2830
# Choose a unique organization name e.g., based on the global account subdomain and subaccount name
29-
cf_org_name = "<unique_org_name>"
31+
cf_org_name = "<unique org name>"
32+
# hana cloud admin users
33+
hana_cloud_admins = ["[email protected]"]
3034
# Additional Cloud Foundry users
3135
cf_space_developers = ["[email protected]"]
3236
cf_space_managers = ["[email protected]"]

released/discovery_center/mission_4327/step1/variables.tf

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ variable "subaccount_admins" {
4343
###
4444

4545
# Plan_name update
46-
variable "service_plan__bas" {
47-
description = "BAS plan"
48-
type = string
49-
default = "free"
50-
}
5146

5247
variable "service_plan__build_workzone" {
5348
description = "Build Workzone plan"
@@ -61,6 +56,20 @@ variable "service_plan__hana_cloud" {
6156
default = "hana-free"
6257
}
6358

59+
variable "hana_cloud_admins" {
60+
type = list(string)
61+
description = "Defines the colleagues who are added as admins to access the instance of SAP HANA Cloud."
62+
}
63+
# CICD service plan
64+
variable "cicd_service_plan" {
65+
type = string
66+
description = "The plan for Continous Integration & Delivery subscription"
67+
default = "free"
68+
validation {
69+
condition = contains(["free", "default"], var.cicd_service_plan)
70+
error_message = "Invalid value for Continous Integraion & Delivery. Only 'free' and 'default' are allowed."
71+
}
72+
}
6473
###
6574
# Cloud Foundry
6675
###
@@ -105,4 +114,4 @@ variable "create_tfvars_file_for_next_stage" {
105114
description = "Switch to enable the creation of the tfvars file for the next stage."
106115
type = bool
107116
default = false
108-
}
117+
}

0 commit comments

Comments
 (0)