Skip to content

Commit f666996

Browse files
committed
basic setup
1 parent 964ca0d commit f666996

File tree

28 files changed

+574
-69
lines changed

28 files changed

+574
-69
lines changed

sample-setup/basic-setup/directory-setup/.terraform.lock.hcl

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
11
# Sample Setup for a Basic Directory Structure
22

3+
## Assumptions
34

5+
- We assume that we use the directories as structuring element for the subaccounts i.e., un an unmanaged fashion.
6+
- We assume that we do the directory setup in one run for all involved departments.
7+
8+
## Design Decsion
9+
10+
We decouple the directory creation i.e., the setup of the basic structure from the creation of the operational units namely the subaccounts inside of the directory. The changes on directory level are probably a rare sceanrio compared to the subaccounts (depending on their stage) and we therefore want to avoid side effects as well as lengthy state refreshes.
11+
12+
## Directory Setup
13+
14+
We will create directories for the following departments:
15+
16+
- HR
17+
- Sales
18+
- Finance
19+
20+
In addition we create a directory for shared services.
21+
22+
All directories are located in EMEA.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module "directory" {
2+
source = "../../modules/base-directory-setup"
3+
for_each = var.directory_inputs
4+
business_unit = each.value.business_unit
5+
costcenter = each.value.costcenter
6+
directory_contacts = each.value.directory_contacts
7+
region = each.value.region
8+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
output "directories" {
2+
value = {
3+
for k, v in module.directory : k => {
4+
id = v.directory_id
5+
name = v.directory_name
6+
business_unit = v.business_unit
7+
costcenter = v.costcenter
8+
region = v.region
9+
}
10+
}
11+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
terraform {
2+
required_providers {
3+
btp = {
4+
source = "SAP/btp"
5+
version = "~>1.11.0"
6+
}
7+
}
8+
}
9+
10+
# Configure the BTP Provider
11+
provider "btp" {
12+
globalaccount = var.globalaccount
13+
}
7.74 KB
Binary file not shown.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
variable "globalaccount" {
2+
type = string
3+
description = "The subdomain of the global account on SAP BTP"
4+
}
5+
6+
variable "directory_inputs" {
7+
type = map(object({
8+
business_unit = string
9+
costcenter = string
10+
directory_contacts = list(string)
11+
region = string
12+
}))
13+
description = <<-EOT
14+
The inputs for the directory module.
15+
- `business_unit`: Business unit of the project e.g., HR, IT or Sales
16+
- `costcenter`: Cost center to be used for subaccounts
17+
- `directory_contacts`: Contact persons to be used for directories, added as label
18+
- `region`: The geographical region for a directory. The parameter is optional
19+
If you set it the possible values are: `EMEA`, `APAC`, `AMER`.
20+
Default value: `null`.
21+
EOT
22+
}

sample-setup/modules/base-directory-setup/.terraform.lock.hcl

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## Requirements
2+
3+
| Name | Version |
4+
|------|---------|
5+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.11 |
6+
| <a name="requirement_btp"></a> [btp](#requirement\_btp) | >= 1.11.0 |
7+
8+
## Providers
9+
10+
| Name | Version |
11+
|------|---------|
12+
| <a name="provider_btp"></a> [btp](#provider\_btp) | 1.11.0 |
13+
14+
## Modules
15+
16+
| Name | Source | Version |
17+
|------|--------|---------|
18+
| <a name="module_dir_namings"></a> [dir\_namings](#module\_dir\_namings) | ../sap-btp-naming-conventions-directory | n/a |
19+
20+
## Resources
21+
22+
| Name | Type |
23+
|------|------|
24+
| [btp_directory.self](https://registry.terraform.io/providers/SAP/btp/latest/docs/resources/directory) | resource |
25+
26+
## Inputs
27+
28+
| Name | Description | Type | Default | Required |
29+
|------|-------------|------|---------|:--------:|
30+
| <a name="input_business_unit"></a> [business\_unit](#input\_business\_unit) | Business unit of the project e.g., HR, IT or Sales | `string` | n/a | yes |
31+
| <a name="input_costcenter"></a> [costcenter](#input\_costcenter) | Cost center to be used for subaccounts | `string` | n/a | yes |
32+
| <a name="input_directory_contacts"></a> [directory\_contacts](#input\_directory\_contacts) | Contact persons to be used for directory, added as label | `list(string)` | n/a | yes |
33+
| <a name="input_region"></a> [region](#input\_region) | The geographical region for a directory. The parameter is optional<br/>If you set it the possible values are: `EMEA`, `APAC`, `AMER`.<br/>Default value: `null`. | `string` | `null` | no |
34+
35+
## Outputs
36+
37+
| Name | Description |
38+
|------|-------------|
39+
| <a name="output_business_unit"></a> [business\_unit](#output\_business\_unit) | Business unit of the project e.g., HR, IT or Sales |
40+
| <a name="output_costcenter"></a> [costcenter](#output\_costcenter) | Cost center to be used for subaccounts |
41+
| <a name="output_directory_id"></a> [directory\_id](#output\_directory\_id) | Technical ID of the directory |
42+
| <a name="output_directory_name"></a> [directory\_name](#output\_directory\_name) | The name of the directory |
43+
| <a name="output_region"></a> [region](#output\_region) | The geographical region for a directory. The parameter is optional |
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module "dir_namings" {
2+
source = "../sap-btp-naming-conventions-directory"
3+
business_unit = var.business_unit
4+
costcenter = var.costcenter
5+
directory_contacts = var.directory_contacts
6+
region = var.region
7+
}
8+
9+
10+
resource "btp_directory" "self" {
11+
name = module.dir_namings.directory_name
12+
description = module.dir_namings.directory_description
13+
labels = module.dir_namings.directory_labels
14+
}

0 commit comments

Comments
 (0)