Skip to content

Commit bece0c7

Browse files
committed
update readme
1 parent c0702fb commit bece0c7

File tree

8 files changed

+47
-72
lines changed

8 files changed

+47
-72
lines changed

released/SAP-Inside-Tracks/SITBLR_DEC_2024/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SITBLR DECEMBER 2024 - HandsOn SAP Terraform Provider for SAP BTP
22

3-
## Goal of this HandsOn 🎯
3+
## Goal of this Hands-on 🎯
44

55
In this hands-on exercise you will learn how to use the [Terraform Provider for SAP BTP](https://registry.terraform.io/providers/SAP/btp/latest/docs) to provision and manage resources in SAP BTP. The level of the exercises is beginner. You don't need any prior knowledge about Terraform or the Terraform Provider for SAP BTP. We will guide you through the exercises step by step.
66

released/SAP-Inside-Tracks/SITBLR_DEC_2024/exercises/EXERCISE2/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ As we have all variables in place, you should save the changes now.
112112
> [!NOTE]
113113
> As you can see you have a lot of possibilities to validate the user input in Terraform in this way ensure that the input is correct and meets your corporate requirements.
114114
115+
We have defined the `project_name` which is required for the subaccount creation. We will provide the value for this variable via the `terraform.tfvars` file. Open
116+
the file `terraform.tfvars` and append the following content to the end of the file:
117+
118+
```terraform
119+
project_name = "<YOUR LAST NAME>"
120+
```
121+
115122
### Step 2: Local values
116123

117124
Now we want to leverage the input variables to create a subaccount name that follows a specific naming convention. Here are the conditions:

released/SAP-Inside-Tracks/SITBLR_DEC_2024/exercises/EXERCISE3/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ variable "bas_plan" {
3636
}
3737
```
3838

39-
We define a complex variable type, which is a [list](https://developer.hashicorp.com/terraform/language/expressions/types#lists-tuples) of [objects](https://developer.hashicorp.com/terraform/language/expressions/types#maps-objects). Each object has three attributes: `name`, `plan`, and `amount`. The `name` and `plan` attributes are strings, and the `amount` attribute is a number. We define a default value for the variable, which is an empty list.We will provide values for this parameter via the file `terraform.tfvars` in the next step. Save the changes.
39+
We define a complex variable type, which is a [list](https://developer.hashicorp.com/terraform/language/expressions/types#lists-tuples) of [objects](https://developer.hashicorp.com/terraform/language/expressions/types#maps-objects). Each object has three attributes: `name` and `plan`. The `name` and `plan` attributes are strings. We define a default value for the variable, which is an empty list.We will provide values for this parameter via the file `terraform.tfvars` in the next step. Save the changes.
4040

4141
## Step 2: Add the variable to the tfvars file
4242

released/SAP-Inside-Tracks/SITBLR_DEC_2024/exercises/EXERCISE4/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ output "cloudfoundry_org_name" {
7676
```
7777

7878
You will be prompted to confirm the creation of the environment. Type `yes` and press `Enter` to continue.
79+
The output should look like this:
80+
81+
<img width="600px" src="assets/ex7_3.png" alt="executing terraform apply with cloud foundry provider">
82+
83+
You can also check that everything is in place via the SAP BTP cockpit. You should see the Cloud Foundry environment in the subaccount:
84+
85+
<img width="600px" src="assets/ex7_4.png" alt="SAP BTP Cockpit with Cloud Foundry environment">
7986
## Summary
8087

8188
You've now successfully created a Cloud Foundry environment instance as well as a Cloud Foundry space in SAP BTP.

released/SAP-Inside-Tracks/SITBLR_DEC_2024/exercises/EXERCISE5/README.md

Lines changed: 31 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,6 @@
44

55
In this exercise you will learn how to use the [Terraform Provider for CloudFoundry](https://registry.terraform.io/providers/cloudfoundry/cloudfoundry/latest/docs) and create a space.
66

7-
### Step 3: Adjust the provider configuration
8-
9-
As we are using an additional provider we must make Terraform aware of this in the `provider.tf` file. Open the `provider.tf` file and add the following code to the `required_provider` block:
10-
11-
```terraform
12-
cloudfoundry = {
13-
source = "cloudfoundry/cloudfoundry"
14-
version = "1.1.0"
15-
}
16-
```
17-
18-
To configure the Cloud Foundry provider add the following lines at the end of the file:
19-
20-
```terraform
21-
provider "cloudfoundry" {
22-
api_url = "https://api.cf.${var.region}-001.hana.ondemand.com"
23-
}
24-
```
25-
Save your changes.
26-
27-
> [!WARNING]
28-
> We assume that the Cloud Foundry environment is deployed to the extension landscape 001. If this is not the case the authentication might fail. In a real-world scenario you would probably have a different boundary of content to the module.
29-
307
To fulfill all requirements for the authentication against the Cloud Foundry environment you must export the following environment variables:
318

329
- Windows:
@@ -43,57 +20,36 @@ To fulfill all requirements for the authentication against the Cloud Foundry env
4320
export CF_PASSWORD='<your SAP BTP password>'
4421
```
4522
46-
> [!NOTE]
47-
> Although we do not use the Cloud Foundry part of the module namely the assignment of users to the organization, Terraform will initialize the Cloud Foundry provider and try to authenticate against the Cloud Foundry environment. This is why we need to define the configuration and provide the credentials.
4823
49-
### Step 3: Apply the changes
24+
### Step 1: Adjust the provider configuration
5025
51-
As we have a new provider in place, we need to re-initialize the setup to download the required provider and module. Run the following command:
26+
As we are using an additional provider we must make Terraform aware of this in the `provider.tf` file. Open the `provider.tf` file and add the following code to the `required_provider` block:
5227
53-
```bash
54-
terraform init
28+
```terraform
29+
cloudfoundry = {
30+
source = "cloudfoundry/cloudfoundry"
31+
version = "1.1.0"
32+
}
5533
```
5634

57-
The output should look like this:
58-
59-
<img width="600px" src="assets/ex7_1.png" alt="executing terraform init with cloud foundry provider">
60-
61-
> [!NOTE]
62-
> There is also a command parameter called `--upgrade` for the `terraform init` command. This parameter will *upgrade* the provider to the latest version. As we are adding new providers, we do not need to use this parameter.
63-
64-
You know the drill by now:
65-
66-
1. Plan the Terraform configuration to see what will be created:
67-
68-
```bash
69-
terraform plan
70-
```
71-
72-
The output should look like this:
73-
74-
<img width="600px" src="assets/ex7_2.png" alt="executing terraform plan with cloud foundry">
75-
76-
2. Apply the Terraform configuration to create the environment:
77-
78-
```bash
79-
terraform apply
80-
```
81-
82-
You will be prompted to confirm the creation of the environment. Type `yes` and press `Enter` to continue.
83-
84-
The result should look like this:
35+
To configure the Cloud Foundry provider add the following lines at the end of the file:
8536

86-
<img width="600px" src="assets/ex7_3.png" alt="executing terraform apply with cloud foundry provider">
37+
```terraform
38+
provider "cloudfoundry" {
39+
api_url = "https://api.cf.${var.region}-001.hana.ondemand.com"
40+
}
41+
```
42+
Save your changes.
8743

88-
You can also check that everything is in place via the SAP BTP cockpit. You should see the Cloud Foundry environment in the subaccount:
44+
> [!WARNING]
45+
> We assume that the Cloud Foundry environment is deployed to the extension landscape 001. If this is not the case the authentication might fail. In a real-world scenario you would probably have a different boundary of content to the module.
8946
90-
<img width="600px" src="assets/ex7_4.png" alt="SAP BTP Cockpit with Cloud Foundry environment">
9147

92-
## Creation of a Cloud Foundry space
48+
> [!NOTE]
49+
> Although we do not use the Cloud Foundry part of the module namely the assignment of users to the organization, Terraform will initialize the Cloud Foundry provider and try to authenticate against the Cloud Foundry environment. This is why we need to define the configuration and provide the credentials.
9350
94-
As a last task we also want to add a Cloud Foundry space to the Cloud Foundry environment.
9551

96-
### Step 1: Add the variable to the configuration for Space creation
52+
### Step 2: Add the variable to the configuration for Space creation
9753

9854
First we need to add more variable in the `variables.tf` file. Open the `variables.tf` file and add the following code:
9955

@@ -131,7 +87,7 @@ variable "cf_space_auditors" {
13187

13288
This allows us to specify the name of the Cloud Foundry space. We also define a default value (`dev`) for the variable. Save the changes.
13389

134-
### Step 2: Cloudfoundry Space Creation and Role Assignments
90+
### Step 3: Cloudfoundry Space Creation and Role Assignments
13591

13692
To trigger the creation of a Cloud Foundry space and space roles, Open the `main.tf` file and add the following code:
13793

@@ -173,7 +129,7 @@ resource "cloudfoundry_space_role" "cf_space_auditors" {
173129
}
174130
```
175131

176-
### Step 3: Add the variables to tfvar file
132+
### Step 4: Add the variables to tfvar file
177133

178134
Now we can add `space developers` and `space managers` to the space we created, Add following variables to your `tfvars` file.
179135

@@ -183,21 +139,26 @@ cf_space_developers = ["[email protected]"]
183139
```
184140
Save the changes.
185141

186-
### Step 4: Apply the changes
187-
142+
### Step 5: Apply the changes
188143
As we have all prerequisites already in place when it comes to provider configuration and authentication, we can proceed with applying the changes.
189144

190-
1. Plan the Terraform configuration to see what will be created:
145+
1. As we have a new provider in place, we need to re-initialize the setup to download the required provider and module. Run the following command:
146+
147+
```bash
148+
terraform init
149+
```
150+
151+
2. Plan the Terraform configuration to see what will be created:
191152

192153
```bash
193154
terraform plan
194155
```
195156

196157
The output should look like this:
197158

198-
<img width="600px" src="assets/ex7_6.png" alt="executing terraform plan for cloud foundry space creation">
159+
<img width="600px" src="assets/ex7_2.png" alt="executing terraform plan for cloud foundry space creation">
199160

200-
2. Apply the Terraform configuration to create the space:
161+
3. Apply the Terraform configuration to create the space:
201162

202163
```bash
203164
terraform apply
-530 KB
Loading
-180 KB
Loading
-447 KB
Loading

0 commit comments

Comments
 (0)