|
1 |
| -# Set Up SAP BTP Account using Terraform – Cloud Foundry |
| 1 | +# Discovery Center Mission: Discovery Center mission - Deliver Connected Experiences with a single view of Material Availability |
2 | 2 |
|
3 |
| -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. |
| 3 | +## Overview |
4 | 4 |
|
5 |
| -Currently, the SAP BTP provider is available in beta for non productive usage: [SAP BTP Terraform](https://registry.terraform.io/providers/SAP/btp/latest). |
| 5 | +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/) |
6 | 6 |
|
7 |
| -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: |
| 7 | +## Content of setup |
8 | 8 |
|
9 |
| -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). |
10 |
| -2. Enables the SAP BTP runtime (Cloud Foundry or Kyma). |
11 |
| -3. Creates the neccessary subscription to applications: SAP Business Application Studio (BAS), SAP Build Work Zone, standard edition, etc. |
12 |
| -4. Assigns users the neccessary roles required to access the applications, such as SAP Business Application Studio. |
13 |
| -5. Adds additional users to the subaccount. |
14 |
| -### [Entitlements ](https://github.tools.sap/refapps/incidents-mgmt/blob/main/documentation/administrate/Prepare-BTP/Configure-BTP-CF.md) |
| 9 | +The setup comprises the following resources: |
15 | 10 |
|
16 |
| -| Service | Plan | Quota required | |
17 |
| -| ------------- | :-----------: | ----: | |
18 |
| -| Cloud Foundry Runtime | MEMORY | 1 | |
19 |
| -| SAP Build Work Zone, standard edition | Standard | 1 | |
20 |
| -| SAP HANA Cloud | hana | 1 | |
21 |
| -| SAP HANA Cloud | tools | 1 | |
22 |
| -| SAP HANA Schemas & HDI Containers | hdi-shared | 1 | |
| 11 | +- Creation of the SAP BTP subaccount |
| 12 | +- Entitlements of services |
| 13 | +- Subscriptions to applications |
| 14 | +- Role collection assignments to users |
| 15 | +- Creation of CF environments |
| 16 | +- Management of users and roles on org and space level |
23 | 17 |
|
24 |
| -## Deploy the resources |
| 18 | +## Deploying the resources |
25 | 19 |
|
26 | 20 | To deploy the resources you must:
|
27 |
| -1. Clone repository `git clone https://github.com/SAP-samples/btp-terraform-samples.git` |
28 |
| -2. Navigate to `released/discovery_center/mission_4327/setup_subaccount_cf` |
29 |
| -3. You will be seeing these files named `main.tf`,`provider.tf`,`samples.tfvars`,`variables.tf`. |
30 |
| -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) |
31 |
| -Follow these steps to use the script: |
32 |
| -5. Set `BTP_USERNAME`,`BTP_PASSWORD`,`CF_USER` and `CF_PASSWORD` as ENV variables. |
33 |
| - |
34 |
| -Windows PowerShell: |
35 |
| -```Powershell |
36 |
| - $env:BTP_USERNAME="<your email address>" |
37 |
| - $env:BTP_PASSWORD="<your password>" |
38 |
| - $env:CF_USER="<your email address>" |
39 |
| - $env:CF_PASSWORD="<your password>" |
40 |
| -``` |
41 |
| -Linux, macOS: |
42 |
| -```mac OS |
43 |
| - export BTP_USERNAME="<your email address>" |
44 |
| - export BTP_PASSWORD="<your password>" |
45 |
| - export CF_USER="<your email address>" |
46 |
| - export CF_PASSWORD="<your password>" |
47 |
| -``` |
48 |
| -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: |
49 | 21 |
|
50 |
| - ```shell |
51 |
| - terraform init |
52 |
| - ``` |
| 22 | +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. |
53 | 23 |
|
54 |
| -7. **Review Changes**: Generate an execution plan to review the changes that will be made to your SAP BTP account. Run: |
| 24 | +2. Change the variables in the `samples.tfvars` file in the main folder to meet your requirements |
55 | 25 |
|
56 |
| - ```shell |
57 |
| - terraform plan |
58 |
| - ``` |
| 26 | + > ⚠ 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]`. |
59 | 27 |
|
60 |
| -8. **Apply Configuration**: Apply the Terraform configuration to create the SAP BTP subaccount and entitlements. Run: |
| 28 | +3. Execute the apply.sh script. |
61 | 29 |
|
62 |
| - ```shell |
63 |
| - terraform apply |
64 |
| - ``` |
| 30 | +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. |
65 | 31 |
|
66 |
| - Confirm the changes by typing "yes." |
| 32 | +5. Clean up by running the destroy.sh script. |
67 | 33 |
|
68 |
| -9. **Cleanup**: After your session or project is complete, you can delete the SAP BTP subaccount and associated resources to avoid charges: |
69 |
| - |
70 |
| - ```shell |
71 |
| - terraform destroy |
72 |
| - ``` |
73 |
| - |
74 |
| - Confirm the resource destruction by typing "yes." |
75 |
| - |
76 |
| -11. **Optional**: You can remove the Terraform state file (`terraform.tfstate`) manually if needed. |
77 |
| - |
78 |
| -Please exercise caution when using this script, especially in production environments, and ensure you understand the resources that will be created or modified. |
0 commit comments