|
1 | 1 | # Set Up SAP BTP Account using Terraform – Cloud Foundry
|
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 | +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. |
4 | 4 |
|
5 | 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).
|
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 | +The Terraform script documented here automates the setup of an SAP BTP subaccount based on a predefined template. The Terraform script performs the following steps: |
| 8 | + |
| 9 | +1. Creates a new subaccount in your enterprise global account in SAP BTP. |
| 10 | +1. Configures the SAP BTP entitlements listed in section [Entitlements](#entitlements) below in your subaccount. |
| 11 | +2. Enables the SAP BTP, Cloud Foundry runtime and adds your SAP BTP user to the Cloud Foundry org. |
| 12 | +3. Subscribes to SAP HANA Cloud administration tools and assigns the role collection **SAP HANA Cloud Administrator** to your SAP BTP user. |
| 13 | +5. Adds additional dummy users to the subaccount. |
8 | 14 |
|
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 | 15 | ### [Entitlements ](https://github.tools.sap/refapps/incidents-mgmt/blob/main/documentation/administrate/Prepare-BTP/Configure-BTP-CF.md)
|
15 | 16 |
|
16 | 17 | | Service | Plan | Quota required |
|
17 | 18 | | ------------- | :-----------: | ----: |
|
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 | |
| 19 | +| Cloud Foundry Runtime | free (Environment) | 1 | |
| 20 | +| SAP Build Work Zone, standard edition | free (Application) | 1 | |
| 21 | +| SAP HANA Cloud | hana-free | 1 | |
| 22 | +| SAP HANA Cloud | tools (Application) | 1 | |
22 | 23 | | SAP HANA Schemas & HDI Containers | hdi-shared | 1 |
|
| 24 | +| SAP Continuous Integration and Delivery | free (Application) | 1 | |
23 | 25 |
|
24 | 26 | ## Deploy the resources
|
25 | 27 |
|
26 |
| -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. |
| 28 | +> **Prerequisites** |
| 29 | +> |
| 30 | +> - You have installed Terraform. See [Install Terraform](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli) for detailed instructions. |
| 31 | +> - You have an enterprise global account in SAP BTP. To use services for free, you can sign up for an SAP BTPEA (SAP BTP Enterprise Agreement) or a Pay-As-You-Go for SAP BTP global account and make use of the free tier services only. See [Using Free Service Plans](https://help.sap.com/docs/btp/sap-business-technology-platform/using-free-service-plans?version=Cloud). |
| 32 | +
|
| 33 | + |
| 34 | +1. Clone the repository `git clone https://github.com/SAP-samples/btp-terraform-samples.git` to a directory on your machine. This will create a folder **btp-terraform-samples** in your directory. |
| 35 | +2. Open the **btp-terraform-samples/released/discovery_center/mission_4327/step1** directory. |
| 36 | +4. Create a new file named **terraform.tfvars** and copy the content of the **samples.tfvars** file to the **terraform.tfvars** file. |
| 37 | +5. Make changes to the **terraform.tfvars** file: |
| 38 | + 1. In line 5, replace `<your-global-account-subdomain>` with the subdomain of your global account. |
| 39 | + 2. In line 10, replace `<subaccount-region>` with the region where you want to create a subaccount. |
| 40 | + 3. In line 11, replace `<your-subacccunt-name>` with a name that is unique within your global account. |
| 41 | + |
| 42 | + > The script uses free tier service plans by default. If you want to use it for production, you have to update the service plans in the **terraform.tfvars** file accordingly. |
| 43 | + > The name of your Cloud Foundry org will be generated by appending `CF-Org` to your subaccount's name. This ensures that your Cloud Foundry org name will be unique within your global account. |
| 44 | +
|
| 45 | +6. Configure your SAP BTP credentials as environment variables. Copy the commands relevant for the shell you're using: |
33 | 46 |
|
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: |
| 47 | + Windows PowerShell: |
| 48 | + ```Powershell |
| 49 | + $env:BTP_USERNAME="<your email address>" |
| 50 | + $env:BTP_PASSWORD="<your password>" |
| 51 | + ``` |
| 52 | + Linux, macOS: |
| 53 | + ```mac OS |
| 54 | + export BTP_USERNAME="<your-email-address>" |
| 55 | + export BTP_PASSWORD="<your-password>" |
| 56 | + ``` |
| 57 | +6. In the terminal, navigate to the directory containing your Terraform configuration files. |
| 58 | +
|
| 59 | +7. Run the following command to initialize and upgrade Terraform plugins: |
49 | 60 |
|
50 | 61 | ```shell
|
51 | 62 | terraform init
|
52 | 63 | ```
|
53 | 64 |
|
54 |
| -7. **Review Changes**: Generate an execution plan to review the changes that will be made to your SAP BTP account. Run: |
| 65 | +7. Run the following command to generate an execution plan to review the changes that will be made to your SAP BTP account: |
55 | 66 |
|
56 | 67 | ```shell
|
57 | 68 | terraform plan
|
58 | 69 | ```
|
59 | 70 |
|
60 |
| -8. **Apply Configuration**: Apply the Terraform configuration to create the SAP BTP subaccount and entitlements. Run: |
| 71 | +8. Run the following command to apply the Terraform configuration to create the SAP BTP subaccount and entitlements: |
61 | 72 |
|
62 | 73 | ```shell
|
63 | 74 | terraform apply
|
64 | 75 | ```
|
65 | 76 |
|
66 |
| - Confirm the changes by typing "yes." |
| 77 | + When prompted, type `yes` to confirm the changes. |
67 | 78 |
|
68 |
| -9. **Cleanup**: After your session or project is complete, you can delete the SAP BTP subaccount and associated resources to avoid charges: |
| 79 | +9. (Optional) Run the following command to delete the SAP BTP subaccount and associated resources after your session or project is complete: |
69 | 80 |
|
70 | 81 | ```shell
|
71 | 82 | terraform destroy
|
72 | 83 | ```
|
73 | 84 |
|
74 |
| - Confirm the resource destruction by typing "yes." |
| 85 | + When prompted, type `yes` to confirm the resources' destruction. |
| 86 | +
|
| 87 | + > By cleaning up, you ensure that no unwanted charges are accumulated by your SAP BTP enterprise account: |
75 | 88 |
|
76 |
| -11. **Optional**: You can remove the Terraform state file (`terraform.tfstate`) manually if needed. |
| 89 | +> You can remove the Terraform state file (`terraform.tfstate`) manually if needed. |
77 | 90 |
|
78 |
| -Please exercise caution when using this script, especially in production environments, and ensure you understand the resources that will be created or modified. |
| 91 | +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