Skip to content

Commit 317c441

Browse files
committed
chore: Update solution for SIT
1 parent 6ae422f commit 317c441

File tree

5 files changed

+56
-61
lines changed

5 files changed

+56
-61
lines changed

released/SAP-Inside-Tracks/SITBLR_DEC_2024/solution/main.tf

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ locals {
33
project_subaccount_domain = lower(replace("${var.org_name}-${var.project_name}-${var.stage}", " ", ""))
44
project_subaccount_cf_org = replace("${var.org_name}_${lower(var.project_name)}-${lower(var.stage)}", " ", "_")
55
}
6-
76
resource "btp_subaccount" "project" {
87
name = local.project_subaccount_name
98
subdomain = local.project_subaccount_domain
@@ -13,48 +12,41 @@ resource "btp_subaccount" "project" {
1312
"costcenter" = ["${var.costcenter}"]
1413
}
1514
}
16-
17-
resource "btp_subaccount_role_collection_assignment" "subaccount_users" {
18-
for_each = toset(var.emergency_admins)
19-
subaccount_id = btp_subaccount.project.id
20-
role_collection_name = "Subaccount Administrator"
21-
user_name = each.value
22-
}
23-
2415
resource "btp_subaccount_entitlement" "bas" {
2516
subaccount_id = btp_subaccount.project.id
26-
service_name = "sapappstudiotrial"
27-
plan_name = var.bas_plan_name
17+
service_name = var.bas_service_name
18+
plan_name = var.bas_plan
2819
}
29-
resource "btp_subaccount_subscription" "bas-subscribe" {
20+
21+
resource "btp_subaccount_subscription" "bas" {
3022
subaccount_id = btp_subaccount.project.id
31-
app_name = "sapappstudiotrial"
32-
plan_name = var.bas_plan_name
23+
app_name = var.bas_service_name
24+
plan_name = var.bas_plan
3325
depends_on = [btp_subaccount_entitlement.bas]
3426
}
35-
resource "btp_subaccount_role_collection_assignment" "Business_Application_Studio_Administrator" {
27+
28+
resource "btp_subaccount_role_collection_assignment" "bas_admin" {
3629
for_each = toset(var.bas_admins)
3730
subaccount_id = btp_subaccount.project.id
3831
role_collection_name = "Business_Application_Studio_Administrator"
3932
user_name = each.value
40-
depends_on = [btp_subaccount_subscription.bas-subscribe]
33+
depends_on = [btp_subaccount_subscription.bas]
4134
}
4235

43-
resource "btp_subaccount_role_collection_assignment" "Business_Application_Studio_Developer" {
36+
resource "btp_subaccount_role_collection_assignment" "bas_developer" {
37+
for_each = toset(var.bas_developers)
4438
subaccount_id = btp_subaccount.project.id
4539
role_collection_name = "Business_Application_Studio_Developer"
46-
for_each = toset(var.bas_developers)
4740
user_name = each.value
48-
depends_on = [btp_subaccount_subscription.bas-subscribe]
41+
depends_on = [btp_subaccount_subscription.bas]
4942
}
50-
5143
resource "btp_subaccount_environment_instance" "cloudfoundry" {
5244
subaccount_id = btp_subaccount.project.id
5345
name = local.project_subaccount_cf_org
5446
landscape_label = var.cf_landscape_label
5547
environment_type = "cloudfoundry"
5648
service_name = "cloudfoundry"
57-
plan_name = "trial"
49+
plan_name = var.cf_plan
5850
parameters = jsonencode({
5951
instance_name = local.project_subaccount_cf_org
6052
})
@@ -64,7 +56,6 @@ resource "btp_subaccount_environment_instance" "cloudfoundry" {
6456
delete = "30m"
6557
}
6658
}
67-
6859
resource "cloudfoundry_org_role" "my_role" {
6960
for_each = var.cf_org_user
7061
username = each.value
@@ -99,4 +90,4 @@ resource "cloudfoundry_space_role" "cf_space_auditors" {
9990
type = "space_auditor"
10091
space = cloudfoundry_space.space.id
10192
depends_on = [cloudfoundry_org_role.my_role]
102-
}
93+
}

released/SAP-Inside-Tracks/SITBLR_DEC_2024/solution/outputs.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ output "subaccount_name" {
77
value = btp_subaccount.project.name
88
description = "The name of the project subaccount."
99
}
10-
1110
output "cloudfoundry_org_name" {
1211
value = local.project_subaccount_cf_org
1312
description = "The name of the cloudfoundry org connected to the project account."

released/SAP-Inside-Tracks/SITBLR_DEC_2024/solution/provider.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ terraform {
99
version = "~> 1.1.0"
1010
}
1111
}
12-
1312
}
1413

1514
provider "btp" {
1615
globalaccount = var.globalaccount
16+
idp = var.idp
1717
}
18-
1918
provider "cloudfoundry" {
2019
api_url = "https://api.cf.${var.region}-001.hana.ondemand.com"
21-
}
20+
origin = var.idp
21+
}
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
globalaccount = "<YOUR GLOBAL ACCOUNT>"
1+
globalaccount = "<YOUR GLOBAL ACCOUNT SUBDOMAIN>"
2+
idp = null
3+
project_name = "<YOUR LAST NAME>"
24

3-
bas_plan_name = "trial"
4-
bas_admins = ["[email protected]"]
5-
bas_developers = ["[email protected]"]
5+
bas_service_name = "<BAS SERVICE NAME>"
6+
bas_plan = "<BAS PLAN NAME>"
7+
8+
bas_developers = ["[email protected]", "[email protected]"]
69

7-
cf_org_user = ["[email protected]"]
10+
cf_plan = "<CF PLAN NAME>"
11+
cf_org_user = ["[email protected]"]
812
cf_space_developers = ["[email protected]"]

released/SAP-Inside-Tracks/SITBLR_DEC_2024/solution/variables.tf

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,26 @@ variable "globalaccount" {
33
description = "The subdomain of the SAP BTP global account."
44
}
55

6+
variable "idp" {
7+
type = string
8+
description = "Orgin key of Identity Provider"
9+
default = null
10+
}
611
variable "region" {
712
type = string
813
description = "The region where the project account shall be created in."
914
default = "us10"
1015
}
11-
1216
variable "project_name" {
1317
type = string
1418
description = "The subaccount name."
15-
default = "myproj-1234"
19+
default = "proj-1234"
1620

1721
validation {
1822
condition = can(regex("^[a-zA-Z0-9_\\-]{1,200}", var.project_name))
1923
error_message = "Provide a valid project name."
2024
}
2125
}
22-
2326
variable "stage" {
2427
type = string
2528
description = "The stage/tier the account will be used for."
@@ -30,7 +33,6 @@ variable "stage" {
3033
error_message = "Select a valid stage for the project account."
3134
}
3235
}
33-
3436
variable "costcenter" {
3537
type = string
3638
description = "The cost center the account will be billed to."
@@ -41,48 +43,47 @@ variable "costcenter" {
4143
error_message = "Provide a valid cost center."
4244
}
4345
}
44-
45-
variable "bas_plan_name" {
46-
description = "BAS plan"
46+
variable "org_name" {
4747
type = string
48-
default = "free"
49-
}
50-
51-
variable "bas_developers" {
52-
description = "BAS developers"
53-
type = list(string)
54-
48+
description = "Defines to which organization the project account shall belong to."
49+
default = "B2C"
5550
}
56-
5751
variable "bas_admins" {
58-
description = "BAS Admininstrators"
5952
type = list(string)
60-
61-
}
53+
description = "List of users to assign the Administrator role."
6254

63-
variable "org_name" {
64-
type = string
65-
description = "Defines to which organisation the project account shall belong to."
66-
default = "B2C"
6755
}
68-
69-
variable "emergency_admins" {
56+
variable "bas_developers" {
7057
type = list(string)
71-
description = "Defines the colleagues who are added to each subaccount as emergency administrators."
72-
58+
description = "List of users to assign the Developer role."
7359
}
60+
variable "bas_service_name" {
61+
type = string
62+
description = "Service name for Business Application Studio."
63+
default = "sapappstudio"
7464

75-
variable "cf_space_name" {
65+
}
66+
variable "bas_plan" {
7667
type = string
77-
description = "The name of the Cloud Foundry space."
78-
default = "dev"
68+
description = "Plan name for Business Application Studio."
69+
default = "standard-edition"
7970
}
8071

8172
variable "cf_landscape_label" {
8273
type = string
8374
description = "The region where the project account shall be created in."
8475
default = "cf-us10-001"
8576
}
77+
variable "cf_plan" {
78+
type = string
79+
description = "Plan name for Cloud Foundry Runtime."
80+
default = "standard"
81+
}
82+
variable "cf_space_name" {
83+
type = string
84+
description = "The name of the Cloud Foundry space."
85+
default = "dev"
86+
}
8687

8788
variable "cf_org_user" {
8889
type = set(string)

0 commit comments

Comments
 (0)