File tree Expand file tree Collapse file tree 15 files changed +175
-24
lines changed
sap-btp-environment/CloudFoundry
sap-btp-naming-conventions-directory
sap-btp-naming-conventions-subaccount Expand file tree Collapse file tree 15 files changed +175
-24
lines changed Original file line number Diff line number Diff line change 1
1
module "directory" {
2
- source = " ../../modules/base-directory-setup"
3
- for_each = var. directory_inputs
2
+ source = " ../../modules/base-directory-setup"
3
+
4
+ for_each = var. directory_inputs
5
+
4
6
business_unit = each. value . business_unit
5
7
costcenter = each. value . costcenter
6
8
directory_contacts = each. value . directory_contacts
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
# Setup of a Subaccount
2
2
3
- Basic setup of a subaccount. Every subaccount is created seperately
3
+ - Basic setup of a subaccount. Every subaccount is created seperately
4
+ - Naming Conventions and Labels
5
+ - Validation of Geo Region and Subaccount region
6
+ - Default Setup of custom IdP
7
+ - Provision CF env (optional)
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ locals {
18
18
}
19
19
}
20
20
21
+ data "btp_globalaccount" "this" {}
21
22
22
23
module "subaccount_namings" {
23
24
source = " ../../modules/sap-btp-naming-conventions-subaccount"
@@ -36,3 +37,22 @@ resource "btp_subaccount" "self" {
36
37
usage = module. subaccount_namings . subaccount_usage
37
38
labels = module. subaccount_namings . subaccount_labels
38
39
}
40
+
41
+ resource "btp_subaccount_trust_configuration" "custom_idp" {
42
+ subaccount_id = btp_subaccount. self . id
43
+ identity_provider = var. custom_indentity_provider
44
+ name = " default-corp-custom-idp"
45
+ description = " Default Custom IdP of Corporate"
46
+ auto_create_shadow_users = true
47
+ available_for_user_logon = true
48
+ }
49
+
50
+ module "cf_environment" {
51
+ source = " ../../modules/sap-btp-environment/CloudFoundry"
52
+
53
+ count = var. provision_cf_environment ? 1 : 0
54
+
55
+ subaccount_id = btp_subaccount. self . id
56
+ instance_name = module. subaccount_namings . cloudfoundry_org_name
57
+ cf_org_name = module. subaccount_namings . cloudfoundry_org_name
58
+ }
Original file line number Diff line number Diff line change 1
- output "subaccount_id " {
2
- value = btp_subaccount. self . id
3
- description = " Technical ID of the subaccount"
1
+ output "subaccount_url " {
2
+ value = " https://emea.cockpit.btp.cloud.sap/cockpit/#globalaccount/ ${ data . btp_globalaccount . this . id } /subaccount/ ${ btp_subaccount . project_subaccount . id } "
3
+ description = " The URL to the provisioned subaccount on SAP BTP "
4
4
}
5
5
6
- output "subaccount_name" {
7
- value = btp_subaccount. self . name
8
- description = " The name of the subaccount"
6
+ output "cf_api_url" {
7
+ value = module. cf_environment . cf_api_url
8
+ description = " The Cloud Foundry API URL"
9
+ }
10
+
11
+ output "cf_org_id" {
12
+ value = module. cf_environment . cf_org_id
13
+ description = " The Cloud Foundry org ID"
9
14
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -59,3 +59,14 @@ variable "parent_id" {
59
59
description = " ID of the parent directory"
60
60
default = null
61
61
}
62
+
63
+ variable "custom_indentity_provider" {
64
+ type = string
65
+ description = " Custom IdP to be used for subaccount"
66
+ }
67
+
68
+ variable "provision_cf_environment" {
69
+ type = bool
70
+ description = " Provision Cloud Foundry environment in subaccount"
71
+ default = true
72
+ }
Original file line number Diff line number Diff line change
1
+ # SAP BTP - Directory Setup
2
+
3
+ This module encapsulates the creation of a directory on SAP BTP following standardized naming conventions.
4
+
1
5
## Requirements
2
6
3
7
| Name | Version |
Original file line number Diff line number Diff line change
1
+ # SAP BTP - Environment Setup
2
+
3
+ This module encapsulates the creation of a Cloud Foundry environment in a subaccounton SAP BTP.
4
+
5
+ ## Requirements
6
+
7
+ | Name | Version |
8
+ | ------| ---------|
9
+ | <a name =" requirement_terraform " ></a > [ terraform] ( #requirement\_ terraform ) | >= 1.11 |
10
+ | <a name =" requirement_btp " ></a > [ btp] ( #requirement\_ btp ) | >= 1.11.0 |
11
+
12
+ ## Providers
13
+
14
+ | Name | Version |
15
+ | ------| ---------|
16
+ | <a name =" provider_btp " ></a > [ btp] ( #provider\_ btp ) | >= 1.11.0 |
17
+ | <a name =" provider_null " ></a > [ null] ( #provider\_ null ) | n/a |
18
+
19
+ ## Modules
20
+
21
+ No modules.
22
+
23
+ ## Resources
24
+
25
+ | Name | Type |
26
+ | ------| ------|
27
+ | [ btp_subaccount_environment_instance.self] ( https://registry.terraform.io/providers/SAP/btp/latest/docs/resources/subaccount_environment_instance ) | resource |
28
+ | [ null_resource.cache_target_environment] ( https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource ) | resource |
29
+ | [ btp_subaccount_environments.all] ( https://registry.terraform.io/providers/SAP/btp/latest/docs/data-sources/subaccount_environments ) | data source |
30
+
31
+ ## Inputs
32
+
33
+ | Name | Description | Type | Default | Required |
34
+ | ------| -------------| ------| ---------| :--------:|
35
+ | <a name =" input_cf_org_name " ></a > [ cf\_ org\_ name] ( #input\_ cf\_ org\_ name ) | Name of the Cloud Foundry org. | ` string ` | n/a | yes |
36
+ | <a name =" input_instance_name " ></a > [ instance\_ name] ( #input\_ instance\_ name ) | Name of the Cloud Foundry environment instance. | ` string ` | n/a | yes |
37
+ | <a name =" input_plan_name " ></a > [ plan\_ name] ( #input\_ plan\_ name ) | Desired service plan for the Cloud Foundry environment instance. | ` string ` | ` "standard" ` | no |
38
+ | <a name =" input_subaccount_id " ></a > [ subaccount\_ id] ( #input\_ subaccount\_ id ) | ID of the subaccount where the Cloud Foundry environment will be created. | ` string ` | n/a | yes |
39
+
40
+ ## Outputs
41
+
42
+ | Name | Description |
43
+ | ------| -------------|
44
+ | <a name =" output_cf_api_url " ></a > [ cf\_ api\_ url] ( #output\_ cf\_ api\_ url ) | The Cloud Foundry API URL |
45
+ | <a name =" output_cf_org_id " ></a > [ cf\_ org\_ id] ( #output\_ cf\_ org\_ id ) | The Cloud Foundry org ID |
Original file line number Diff line number Diff line change
1
+ data "btp_subaccount_environments" "all" {
2
+ subaccount_id = var. subaccount_id
3
+ }
4
+
5
+ resource "null_resource" "cache_target_environment" {
6
+ triggers = {
7
+ label = [for env in data . btp_subaccount_environments . all . values : env if env . service_name == " cloudfoundry" && env . environment_type == " cloudfoundry" ][0 ].landscape_label
8
+ }
9
+
10
+ lifecycle {
11
+ ignore_changes = all
12
+ }
13
+ }
14
+
15
+ resource "btp_subaccount_environment_instance" "self" {
16
+ subaccount_id = var. subaccount_id
17
+ name = var. instance_name
18
+ environment_type = " cloudfoundry"
19
+ service_name = " cloudfoundry"
20
+ plan_name = var. plan_name
21
+ landscape_label = null_resource. cache_target_environment . triggers . label
22
+
23
+ parameters = jsonencode ({
24
+ instance_name = var.cf_org_name
25
+ })
26
+ }
You can’t perform that action at this time.
0 commit comments