-
Notifications
You must be signed in to change notification settings - Fork 31
3774 stc mission #180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
3774 stc mission #180
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
e87b20c
adding README.md
fabianleh ed22e76
adding tf scripts
fabianleh 94a4b93
fix typo
fabianleh 67ae8bb
updating stc mission step 1 tested succesful, step 2 missing docu
fabianleh ac12fe8
moving space creation in step 2
fabianleh 1206485
update output
fabianleh 26e4966
Merge branch 'main' into 3774_stc_mission
lechnerc77 8bdd235
removing cf provider
fabianleh 58b66b0
Merge branch '3774_stc_mission' of https://github.com/fabianleh/btp-t…
fabianleh a06ba7f
update provider.tf step 2
fabianleh 16d823a
Update in-development/mission_3774_sap_task_center/step_2/variables.tf
fabianleh 3cc4820
update provider.tf step2
fabianleh f067355
removing sap.ids
fabianleh 438bc43
updating cf api url
fabianleh a896d1f
update variables.tf
fabianleh 6ba20fc
updateing step 1 and minor step 2 changes
fabianleh 64427f6
updating sample.tfcars
fabianleh 92da6ef
format fix
fabianleh 0977c07
fix typo
fabianleh c532a44
removing duplicate space creation in main.tf
fabianleh 918c9c7
updating step 2
fabianleh b85838d
fix space def.
fabianleh 67b7af2
subacc id fix
fabianleh 69bddc3
destination creation fix
fabianleh 8ef41e7
fix: validation step2
lechnerc77 07ce54f
resolve merge
lechnerc77 0991996
validation fixes
lechnerc77 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
in-development/mission_3774_sap_task_center/step_1/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Sample Setup of an SAP Task Center on SAP BTP - Step 1 | ||
|
||
## Overview | ||
|
||
This directory contains the setup of SAP Task Center from scratch namely a new subaccount including the relevant entitlements, a Cloud Foundry environment and a Cloud Foundry space. | ||
|
||
This directory contains the configuration the first step of the setup namely: | ||
|
||
- a new subaccount | ||
- the entitlements for SAP Task Center | ||
- the subscription for SAP Build Workzone, standard edition | ||
- the Cloud Foundry environment | ||
- The trust setup to the custom IdP | ||
- Assignment of users to the role collections | ||
|
||
## Deploying the resources | ||
|
||
To deploy the resources of step 1 execute the following commands: | ||
|
||
1. Initialize your workspace: | ||
|
||
```bash | ||
terraform init | ||
``` | ||
|
||
1. Assign the variable values in a `*.tfvars` file e.g., the global account subdomain | ||
|
||
1. You can check what Terraform plans to apply based on your configuration: | ||
|
||
```bash | ||
terraform plan -var-file="<name of your tfvars file>.tfvars" | ||
``` | ||
|
||
1. Apply your configuration to provision the resources: | ||
|
||
```bash | ||
terraform apply -var-file="<name of your tfvars file>.tfvars" | ||
``` | ||
|
||
> **Note** - Some variables of the output of the first step are needed as input for the second step. | ||
|
||
## When finished | ||
|
||
You probably want to remove the assets after trying them out to avoid unnecessary costs. To do so execute the following command: | ||
|
||
```bash | ||
terraform destroy -var-file="<name of your tfvars file>.tfvars" | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
locals { | ||
service_name__sap_task_center = "one-inbox-service" | ||
service_name__build_workzone = "SAPLaunchpad" | ||
} |
86 changes: 86 additions & 0 deletions
86
in-development/mission_3774_sap_task_center/step_1/main.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
############################################################################################### | ||
# Setup of names in accordance to naming convention | ||
############################################################################################### | ||
resource "random_uuid" "uuid" {} | ||
|
||
locals { | ||
random_uuid = random_uuid.uuid.result | ||
project_subaccount_domain = lower(replace("mission-3774-${local.random_uuid}", "_", "-")) | ||
project_subaccount_cf_org = substr(replace("${local.project_subaccount_domain}", "-", ""), 0, 32) | ||
} | ||
############################################################################################### | ||
# Creation of subaccount | ||
############################################################################################### | ||
resource "btp_subaccount" "project" { | ||
name = var.subaccount_name | ||
subdomain = local.project_subaccount_domain | ||
region = lower(var.region) | ||
} | ||
# ------------------------------------------------------------------------------------------------------ | ||
# Assignment of users as sub account administrators | ||
# ------------------------------------------------------------------------------------------------------ | ||
resource "btp_subaccount_role_collection_assignment" "subaccount-admins" { | ||
for_each = toset("${var.subaccount_admins}") | ||
subaccount_id = btp_subaccount.project.id | ||
role_collection_name = "Subaccount Administrator" | ||
user_name = each.value | ||
} | ||
# ------------------------------------------------------------------------------------------------------ | ||
# Assignment of users as sub account service administrators | ||
# ------------------------------------------------------------------------------------------------------ | ||
resource "btp_subaccount_role_collection_assignment" "subaccount-service-admins" { | ||
for_each = toset("${var.subaccount_service_admins}") | ||
subaccount_id = btp_subaccount.project.id | ||
role_collection_name = "Subaccount Service Administrator" | ||
user_name = each.value | ||
} | ||
###################################################################### | ||
# Creation of Cloud Foundry environment | ||
###################################################################### | ||
resource "btp_subaccount_environment_instance" "cloudfoundry" { | ||
subaccount_id = btp_subaccount.project.id | ||
name = local.project_subaccount_cf_org | ||
environment_type = "cloudfoundry" | ||
service_name = "cloudfoundry" | ||
plan_name = "standard" | ||
landscape_label = var.cf_environment_label | ||
parameters = jsonencode({ | ||
instance_name = local.project_subaccount_cf_org | ||
}) | ||
} | ||
############################################################################################### | ||
# Prepare and setup app: SAP Build Workzone, standard edition | ||
############################################################################################### | ||
# Entitle subaccount for usage of app destination SAP Build Workzone, standard edition | ||
resource "btp_subaccount_entitlement" "build_workzone" { | ||
subaccount_id = btp_subaccount.project.id | ||
service_name = local.service_name__build_workzone | ||
plan_name = var.service_plan__build_workzone | ||
amount = var.service_plan__build_workzone == "free" ? 1 : null | ||
} | ||
# Create app subscription to SAP Build Workzone, standard edition (depends on entitlement) | ||
resource "btp_subaccount_subscription" "build_workzone" { | ||
subaccount_id = btp_subaccount.project.id | ||
app_name = local.service_name__build_workzone | ||
plan_name = var.service_plan__build_workzone | ||
depends_on = [btp_subaccount_entitlement.build_workzone] | ||
} | ||
############################################################################################### | ||
# Prepare and setup app: SAP Task Center | ||
############################################################################################### | ||
# Entitle subaccount for usage of app destination SAP Task Center | ||
resource "btp_subaccount_entitlement" "taskcenter" { | ||
subaccount_id = btp_subaccount.project.id | ||
service_name = local.service_name__sap_task_center | ||
plan_name = "standard" | ||
} | ||
# ------------------------------------------------------------------------------------------------------ | ||
# Assignment of users as launchpad administrators | ||
# ------------------------------------------------------------------------------------------------------ | ||
resource "btp_subaccount_role_collection_assignment" "launchpad-admins" { | ||
for_each = toset("${var.launchpad_admins}") | ||
subaccount_id = btp_subaccount.project.id | ||
role_collection_name = "Launchpad_Admin" | ||
user_name = each.value | ||
depends_on = [btp_subaccount_subscription.build_workzone] | ||
} |
24 changes: 24 additions & 0 deletions
24
in-development/mission_3774_sap_task_center/step_1/outputs.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
output "subaccount_id" { | ||
value = btp_subaccount.project.id | ||
description = "The ID of the project subaccount." | ||
} | ||
|
||
output "cf_org_name" { | ||
value = local.project_subaccount_cf_org | ||
description = "The name of the project subaccount." | ||
} | ||
|
||
output "cf_org_id" { | ||
value = btp_subaccount_environment_instance.cloudfoundry.landscape_label | ||
description = "The ID of the Cloud Foundry environment." | ||
} | ||
|
||
output "cf_api_endpoint" { | ||
value = jsondecode(btp_subaccount_environment_instance.cloudfoundry.labels)["API Endpoint"] | ||
description = "API endpoint of the Cloud Foundry environment." | ||
} | ||
|
||
output "cf_landscape_label" { | ||
value = btp_subaccount_environment_instance.cloudfoundry.platform_id | ||
description = "The landscape label of the Cloud Foundry environment." | ||
} |
14 changes: 14 additions & 0 deletions
14
in-development/mission_3774_sap_task_center/step_1/provider.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
### | ||
# Define the required providers for this module | ||
### | ||
terraform { | ||
required_providers { | ||
btp = { | ||
source = "sap/btp" | ||
} | ||
} | ||
} | ||
provider "btp" { | ||
globalaccount = var.globalaccount | ||
cli_server_url = var.cli_server_url | ||
} |
17 changes: 17 additions & 0 deletions
17
in-development/mission_3774_sap_task_center/step_1/sample.tfvars
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# ------------------------------------------------------------------------------------------------------ | ||
# Provider configuration | ||
# ------------------------------------------------------------------------------------------------------ | ||
# Your global account subdomain | ||
globalaccount = "yourglobalaccount" | ||
region = "datacenter" | ||
subaccount_name = "subaccount_name" | ||
cf_environment_label = "cf_environment_label" | ||
|
||
# ------------------------------------------------------------------------------------------------------ | ||
# Project specific configuration (please adapt!) | ||
# ------------------------------------------------------------------------------------------------------ | ||
|
||
subaccount_admins = ["jane.doe@test.com", "john.doe@test.com"] | ||
subaccount_service_admins = ["jane.doe@test.com", "john.doe@test.com"] | ||
custom_idp = "your custom idp" | ||
launchpad_admins = ["jane.doe@test.com", "john.doe@test.com"] |
89 changes: 89 additions & 0 deletions
89
in-development/mission_3774_sap_task_center/step_1/variables.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
###################################################################### | ||
# Customer account setup | ||
###################################################################### | ||
variable "globalaccount" { | ||
type = string | ||
description = "Defines the global account" | ||
default = "yourglobalaccount" | ||
} | ||
|
||
variable "cli_server_url" { | ||
type = string | ||
description = "Defines the CLI server URL" | ||
default = "https://cli.btp.cloud.sap" | ||
} | ||
|
||
# subaccount | ||
variable "subaccount_name" { | ||
type = string | ||
description = "The subaccount name." | ||
default = "UC - Establish a Central Inbox with SAP Task Center" | ||
} | ||
variable "subaccount_id" { | ||
type = string | ||
description = "The subaccount ID." | ||
default = "" | ||
} | ||
# Region | ||
variable "region" { | ||
type = string | ||
description = "The region where the project account shall be created in." | ||
default = "us10" | ||
} | ||
# Cloudfoundry environment label | ||
variable "cf_environment_label" { | ||
type = string | ||
description = "The Cloudfoundry environment label" | ||
default = "cf-us10" | ||
} | ||
|
||
variable "subaccount_admins" { | ||
type = list(string) | ||
description = "Defines the colleagues who are added to each subaccount as subaccount administrators." | ||
default = ["jane.doe@test.com", "john.doe@test.com"] | ||
} | ||
|
||
variable "subaccount_service_admins" { | ||
type = list(string) | ||
description = "Defines the colleagues who are added to each subaccount as subaccount service administrators." | ||
default = ["jane.doe@test.com", "john.doe@test.com"] | ||
} | ||
|
||
variable "launchpad_admins" { | ||
type = list(string) | ||
description = "Defines the colleagues who are added to each subaccount as subaccount service administrators." | ||
default = ["jane.doe@test.com", "john.doe@test.com"] | ||
} | ||
|
||
variable "custom_idp" { | ||
type = string | ||
description = "Defines the custom IdP" | ||
default = "" | ||
} | ||
|
||
variable "environment_label" { | ||
type = string | ||
description = "In case there are multiple environments available for a subaccount, you can use this label to choose with which one you want to go. If nothing is given, we take by default the first available." | ||
default = "cf-us10" | ||
} | ||
|
||
variable "cf_org_name" { | ||
type = string | ||
description = "Name of the Cloud Foundry org." | ||
default = "mission-3774-sap-task-center" | ||
|
||
validation { | ||
condition = can(regex("^.{1,255}$", var.cf_org_name)) | ||
error_message = "The Cloud Foundry org name must not be emtpy and not exceed 255 characters." | ||
} | ||
} | ||
|
||
variable "service_plan__build_workzone" { | ||
type = string | ||
description = "The plan for build_workzone subscription" | ||
default = "free" | ||
validation { | ||
condition = contains(["free", "standard"], var.service_plan__build_workzone) | ||
error_message = "Invalid value for service_plan__build_workzone. Only 'free' and 'standard' are allowed." | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
in-development/mission_3774_sap_task_center/step_2/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Sample Setup of an SAP Task Center on SAP BTP - Step 2 | ||
|
||
## Overview | ||
|
||
This directory contains the setup of SAP Task Center from scratch namely a new subaccount including the relevant entitlements, a Cloud Foundry environment and a Cloud Foundry space. | ||
|
||
This directory contains the configuration the first step of the setup namely: | ||
|
||
- Creation of service instance for SAP Task Center | ||
- Creation of the service key for the service instance | ||
|
||
## Deploying the resources | ||
|
||
To deploy the resources of step 1 execute the following commands: | ||
|
||
1. Initialize your workspace: | ||
|
||
```bash | ||
terraform init | ||
``` | ||
|
||
1. Assign the variable values in a `*.tfvars` file e.g., the global account subdomain | ||
|
||
1. You can check what Terraform plans to apply based on your configuration: | ||
|
||
```bash | ||
terraform plan -var-file="<name of your tfvars file>.tfvars" | ||
``` | ||
|
||
1. Apply your configuration to provision the resources: | ||
|
||
```bash | ||
terraform apply -var-file="<name of your tfvars file>.tfvars" | ||
``` | ||
|
||
> **Note** - Some variables of the output of the first step are needed as input for the second step. | ||
|
||
## When finished | ||
|
||
You probably want to remove the assets after trying them out to avoid unnecessary costs. To do so execute the following command: | ||
|
||
```bash | ||
terraform destroy -var-file="<name of your tfvars file>.tfvars" | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.