@@ -11,76 +11,14 @@ resource "btp_subaccount" "project" {
11
11
region = lower (var. region )
12
12
}
13
13
data "btp_whoami" "me" {}
14
+
14
15
# ##############################################################################################
15
- # Assignment of users as sub account administrators
16
+ # Trust enablement
16
17
# ##############################################################################################
17
- resource "btp_subaccount_role_collection_assignment" "subaccount-admins" {
18
- for_each = toset (" ${ var . subaccount_admins } " )
19
- subaccount_id = btp_subaccount. project . id
20
- role_collection_name = " Subaccount Administrator"
21
- user_name = each. value
22
- }
23
- # #####################################################################
24
- # Creation of Cloud Foundry environment
25
- # #####################################################################
26
- resource "btp_subaccount_environment_instance" "cloudfoundry" {
27
- subaccount_id = btp_subaccount. project . id
28
- name = " my-cf-environment"
29
- landscape_label = " cf-eu10"
30
- environment_type = " cloudfoundry"
31
- service_name = " cloudfoundry"
32
- plan_name = " standard"
33
- # ATTENTION: some regions offer multiple environments of a kind and you must explicitly select the target environment in which
34
- # the instance shall be created using the parameter landscape label.
35
- # available environments can be looked up using the btp_subaccount_environments datasource
36
- parameters = jsonencode ({
37
- instance_name = btp_subaccount.project.subdomain
38
- })
39
- timeouts = {
40
- create = " 1h"
41
- update = " 35m"
42
- delete = " 30m"
43
- }
44
- }
45
-
46
- # #####################################################################
47
- # Add "sleep" resource for generic purposes
48
- # #####################################################################
49
- resource "time_sleep" "wait_a_few_seconds" {
50
- create_duration = " 30s"
51
- }
52
-
53
- # #####################################################################
54
- # Create Cloudfoundry space
55
- # #####################################################################
56
-
57
- output "org_id" {
58
- value = btp_subaccount_environment_instance. cloudfoundry . platform_id
59
-
60
- }
61
-
62
- resource "cloudfoundry_org_role" "my_role" {
63
- for_each = var. cf_org_user
64
- username = each. value
65
- type = " organization_user"
66
- org = btp_subaccount_environment_instance. cloudfoundry . platform_id
67
- }
68
-
69
- # Create Space
70
- resource "cloudfoundry_space" "team_space" {
71
- depends_on = [cloudfoundry_org_role . my_role ]
72
- name = var. space_name
73
- org = btp_subaccount_environment_instance. cloudfoundry . platform_id
74
- }
75
-
76
- resource "cloudfoundry_space_role" "space_role" {
77
- depends_on = [cloudfoundry_org_role . my_role ]
78
- for_each = var. cf_space_manager
79
- username = each. value
80
- type = " space_manager"
81
- space = cloudfoundry_space. team_space . id
18
+ resource "btp_subaccount_trust_configuration" "ias" {
19
+ subaccount_id = btp_subaccount. project . id
20
+ identity_provider = " terraformeds.accounts.ondemand.com"
82
21
}
83
-
84
22
# #####################################################################
85
23
# Add entitlement for BAS, Subscribe BAS and add roles
86
24
# #####################################################################
@@ -119,9 +57,9 @@ resource "btp_subaccount_entitlement" "build_workzone" {
119
57
}
120
58
resource "btp_subaccount_subscription" "build_workzone_subscribe" {
121
59
subaccount_id = btp_subaccount. project . id
122
- app_name = " SAPLaunchpad "
60
+ app_name = " SAPLaunchpadSMS "
123
61
plan_name = var. build_workzone_plan_name
124
- depends_on = [btp_subaccount_entitlement . build_workzone ]
62
+ depends_on = [btp_subaccount_entitlement . build_workzone , btp_subaccount_trust_configuration . ias ]
125
63
}
126
64
resource "btp_subaccount_role_collection_assignment" "launchpad_admin" {
127
65
subaccount_id = btp_subaccount. project . id
@@ -154,3 +92,65 @@ resource "btp_subaccount_entitlement" "hana-hdi-shared" {
154
92
service_name = " hana"
155
93
plan_name = " hdi-shared"
156
94
}
95
+
96
+
97
+ # #####################################################################
98
+ # Creation of Cloud Foundry environment
99
+ # #####################################################################
100
+ resource "btp_subaccount_environment_instance" "cloudfoundry" {
101
+ subaccount_id = btp_subaccount. project . id
102
+ name = " my-cf-environment"
103
+ landscape_label = " cf-eu10"
104
+ environment_type = " cloudfoundry"
105
+ service_name = " cloudfoundry"
106
+ plan_name = " standard"
107
+ # ATTENTION: some regions offer multiple environments of a kind and you must explicitly select the target environment in which
108
+ # the instance shall be created using the parameter landscape label.
109
+ # available environments can be looked up using the btp_subaccount_environments datasource
110
+ parameters = jsonencode ({
111
+ instance_name = btp_subaccount.project.subdomain
112
+ })
113
+ timeouts = {
114
+ create = " 1h"
115
+ update = " 35m"
116
+ delete = " 30m"
117
+ }
118
+ }
119
+
120
+ # #####################################################################
121
+ # Add "sleep" resource for generic purposes
122
+ # #####################################################################
123
+ resource "time_sleep" "wait_a_few_seconds" {
124
+ create_duration = " 30s"
125
+ }
126
+
127
+ # #####################################################################
128
+ # Create Cloudfoundry space
129
+ # #####################################################################
130
+
131
+ output "org_id" {
132
+ value = btp_subaccount_environment_instance. cloudfoundry . platform_id
133
+
134
+ }
135
+
136
+ resource "cloudfoundry_org_role" "my_role" {
137
+ for_each = var. cf_org_user
138
+ username = each. value
139
+ type = " organization_user"
140
+ org = btp_subaccount_environment_instance. cloudfoundry . platform_id
141
+ }
142
+
143
+ # Create Space
144
+ resource "cloudfoundry_space" "team_space" {
145
+ depends_on = [cloudfoundry_org_role . my_role ]
146
+ name = var. space_name
147
+ org = btp_subaccount_environment_instance. cloudfoundry . platform_id
148
+ }
149
+
150
+ resource "cloudfoundry_space_role" "space_role" {
151
+ depends_on = [cloudfoundry_org_role . my_role ]
152
+ for_each = var. cf_space_manager
153
+ username = each. value
154
+ type = " space_manager"
155
+ space = cloudfoundry_space. team_space . id
156
+ }
0 commit comments