Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions released/discovery_center/mission_4327/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Discovery Center mission: Develop a Full-Stack CAP Application Following the SAP BTP Developer’s Guide (4327)

## Overview

This sample shows how to setup your SAP BTP account for the Discovery Center Mission - [Develop a Full-Stack CAP Application Following the SAP BTP Developer’s Guide](https://discovery-center.cloud.sap/index.html#/missiondetail/4327/) for your Enterprise BTP Account.

## Content of setup (step1)

The setup comprises the following resources:

- Creation of the SAP BTP subaccount
- Entitlements of services
- Subscriptions to applications
- Role collection assignments to users
- Creation of CF environment and CF org

After this a setup step2 will create a CF space in the before created CF org and users and roles will be assigned on CF org and space level

## Deploying the resources

Make sure that you are familiar with SAP BTP and know both the [Get Started with btp-terraform-samples](https://github.com/SAP-samples/btp-terraform-samples/blob/main/GET_STARTED.md) and the [Get Started with the Terraform Provider for BTP](https://developers.sap.com/tutorials/btp-terraform-get-started.html)

To deploy the resources you must:

### Setup Step1

1. Set your credentials as environment variables

```bash
export BTP_USERNAME ='<Email address of your BTP user>'
export BTP_PASSWORD ='<Password of your BTP user>'
```

2. Go into folder `step1` and change the variables in the `sample.tfvars` file to meet your requirements

> The minimal set of parameters you should specify (besides user_email and password) is global account (i.e. its subdomain) and the used custom_idp and all user assignments

> Keep the setting `create_tfvars_file_for_step2 = true` so that a `terraform.tfvars` file is created which contains your needed variables to execute setup `step2` without specifying them again in sample.tfvars there.

3. In folder `step1` you initialize your workspace:

```bash
terraform init
```

4. You can check what Terraform plans to apply based on your configuration:

```bash
terraform plan -var-file="sample.tfvars"
```

5. Apply your configuration to provision the resources:

```bash
terraform apply -var-file="sample.tfvars"
```

6. Verify e.g., in BTP cockpit that a new subaccount with a SAP HANA Cloud and SAP Build Work Zone subscriptions have been created.

### Setup Step2

7. Navigate into step2_cf directory and initialize your workspace there as well:

```bash
terraform init
```
8. You can check what Terraform plans to apply based on your configuration:

```bash
terraform plan -var-file="terraform.tfvars"
```

9. Apply your configuration to provision the resources:

```bash
terraform apply -var-file="terraform.tfvars"
```
10. Verify e.g., in BTP cockpit that after step2 the specified users in sample.tfvars have been assigned with roles in the created cloundfoundry org and space.

With this you have completed the quick account setup as described in the Discovery Center Mission - [Develop a Full-Stack CAP Application Following the SAP BTP Developer’s Guide](https://discovery-center.cloud.sap/index.html#/missiondetail/4327/).

## In the end

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="terraform.tfvars"
```
81 changes: 18 additions & 63 deletions released/discovery_center/mission_4327/step1/README.md
Original file line number Diff line number Diff line change
@@ -1,78 +1,33 @@
# Set Up SAP BTP Account using Terraform – Cloud Foundry
# Discovery Center Mission: Discovery Center mission - Deliver Connected Experiences with a single view of Material Availability

The Terraform provider for SAP Business Technology Platform (BTP) enables you to automate the provisioning, management, and configuration of resources on SAP BTP. By leveraging this provider, you can simplify and streamline the deployment and maintenance of SAP BTP services and applications.
## Overview

Currently, the SAP BTP provider is available in beta for non productive usage: [SAP BTP Terraform](https://registry.terraform.io/providers/SAP/btp/latest).
This sample shows how to create a landscape for the Discovery Center Mission - [Deliver Connected Experiences with a single view of Material Availability](https://discovery-center.cloud.sap/missiondetail/4356/)

The Terraform script documented here automates the setup of an SAP BTP subaccount based on a predefined template. The scripts can be used create SAP BTP subaccount with Cloud Foundry or Kyma runtime. The Terraform script does the below configuration after creating a SAP BTP subaccount:
## Content of setup

1. Configures the SAP BTP entitlements required to complete the mission. See [Setup SAP BTP Account using Terraform](https://github.com/SAP-samples/btp-terraform-samples/blob/main/released/discovery_center/mission_4327/step1/README.md#entitlements).
2. Enables the SAP BTP runtime (Cloud Foundry or Kyma).
3. Creates the neccessary subscription to applications: SAP Business Application Studio (BAS), SAP Build Work Zone, standard edition, etc.
4. Assigns users the neccessary roles required to access the applications, such as SAP Business Application Studio.
5. Adds additional users to the subaccount.
### [Entitlements ](https://github.tools.sap/refapps/incidents-mgmt/blob/main/documentation/administrate/Prepare-BTP/Configure-BTP-CF.md)
The setup comprises the following resources:

| Service | Plan | Quota required |
| ------------- | :-----------: | ----: |
| Cloud Foundry Runtime | MEMORY | 1 |
| SAP Build Work Zone, standard edition | Standard | 1 |
| SAP HANA Cloud | hana | 1 |
| SAP HANA Cloud | tools | 1 |
| SAP HANA Schemas & HDI Containers | hdi-shared | 1 |
- Creation of the SAP BTP subaccount
- Entitlements of services
- Subscriptions to applications
- Role collection assignments to users
- Creation of CF environments
- Management of users and roles on org and space level

## Deploy the resources
## Deploying the resources

To deploy the resources you must:
1. Clone repository `git clone https://github.com/SAP-samples/btp-terraform-samples.git`
2. Navigate to `released/discovery_center/mission_4327/setup_subaccount_cf`
3. You will be seeing these files named `main.tf`,`provider.tf`,`samples.tfvars`,`variables.tf`.
4. Create a file named `terraform.tfvars` and copy `samples.tfvars` content to `terraform.tfvars`. Update the variables to meet your requirements (By default free-tier plans are used, if you want to use it for production update in the `terraform.tfvars` accordingly)
Follow these steps to use the script:
5. Set `BTP_USERNAME`,`BTP_PASSWORD`,`CF_USER` and `CF_PASSWORD` as ENV variables.

Windows PowerShell:
```Powershell
$env:BTP_USERNAME="<your email address>"
$env:BTP_PASSWORD="<your password>"
$env:CF_USER="<your email address>"
$env:CF_PASSWORD="<your password>"
```
Linux, macOS:
```mac OS
export BTP_USERNAME="<your email address>"
export BTP_PASSWORD="<your password>"
export CF_USER="<your email address>"
export CF_PASSWORD="<your password>"
```
6. **Install Terraform Plugins**: Open a terminal and navigate to the directory containing your Terraform configuration files. Run the following command to initialize and upgrade Terraform plugins:

```shell
terraform init
```
1. Export environment variables BTP_USERNAME, BTP_PASSWORD, CF_USER, and CF_PASSWORD with your username and password for the custom IdP of your global account.

7. **Review Changes**: Generate an execution plan to review the changes that will be made to your SAP BTP account. Run:
2. Change the variables in the `samples.tfvars` file in the main folder to meet your requirements

```shell
terraform plan
```
> ⚠ NOTE: You should pay attention **specifically** to the users defined in the samples.tfvars whether they already exist in your SAP BTP accounts. Otherwise you might get error messages like e.g. `Error: The user could not be found: [email protected]`.

8. **Apply Configuration**: Apply the Terraform configuration to create the SAP BTP subaccount and entitlements. Run:
3. Execute the apply.sh script.

```shell
terraform apply
```
4. Verify e.g., in BTP cockpit that a new subaccount with a integration suite, SAP Business Application Studio, CF environment instance and a CF space have been created.

Confirm the changes by typing "yes."
5. Clean up by running the destroy.sh script.

9. **Cleanup**: After your session or project is complete, you can delete the SAP BTP subaccount and associated resources to avoid charges:

```shell
terraform destroy
```

Confirm the resource destruction by typing "yes."

11. **Optional**: You can remove the Terraform state file (`terraform.tfstate`) manually if needed.

Please exercise caution when using this script, especially in production environments, and ensure you understand the resources that will be created or modified.
Loading