You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: released/SAP-Inside-Tracks/SITBLR_DEC_2024/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# SITBLR DECEMBER 2024 - HandsOn SAP Terraform Provider for SAP BTP
2
2
3
-
## Goal of this HandsOn 🎯
3
+
## Goal of this Hands-on 🎯
4
4
5
5
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.
Copy file name to clipboardExpand all lines: released/SAP-Inside-Tracks/SITBLR_DEC_2024/exercises/EXERCISE1/README.md
+11-2Lines changed: 11 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,10 +34,11 @@ terraform {
34
34
35
35
provider "btp" {
36
36
globalaccount = var.globalaccount
37
+
idp = var.idp
37
38
}
38
39
```
39
40
40
-
What have we done? First we defined which provider we want to use and which version of the provider we want to use. In this case we want to use the provider `sap/btp` in version `1.8.0` (including potential patch versions). Then we defined the provider configuration. In this case we only need to provide the `globalaccount`parameter where we reference a variable. We will define this variable in the next step.
41
+
What have we done? First we defined which provider we want to use and which version of the provider we want to use. In this case we want to use the provider `sap/btp` in version `1.8.0` (including potential patch versions). Then we defined the provider configuration. In this case we need to provide the `globalaccount`and `idp` parameters where we reference a variable. We will define this variable in the next step.
41
42
42
43
> [!NOTE]
43
44
> We do not need any authentication information in this file. We provided the authentication information via environment variables.
@@ -49,18 +50,26 @@ variable "globalaccount" {
49
50
type = string
50
51
description = "The subdomain of the SAP BTP global account."
51
52
}
53
+
variable "idp" {
54
+
type = string
55
+
description = "Orgin key of Identity Provider"
56
+
default = null
57
+
}
52
58
```
53
59
54
-
We have now defined the variable `globalaccount` which is required for the provider configuration. We will provide the value for this variable via the `terraform.tfvars` file. Open
60
+
We have now defined the variable `globalaccount`and `idp`which is required for the provider configuration. We will provide the value for this variable via the `terraform.tfvars` file. Open
55
61
the file `terraform.tfvars` and add the following content:
56
62
57
63
```terraform
58
64
globalaccount = "<YOUR GLOBAL ACCOUNT SUBDOMAIN>"
65
+
idp = null
59
66
```
60
67
61
68
The SAP BTP Global Account Subdomain can be found in the SAP BTP Cockpit as shown below
62
69
<imgwidth="600px"src="assets/trial-account.png"alt="SAP BTP Global Account Subdomain">
63
70
71
+
The `idp` (Identity Provider Orgin Key ) is set to null. If a [Custom Identity Provider](https://help.sap.com/docs/btp/sap-business-technology-platform/log-on-with-custom-identity-provider-to-sap-btp-cockpit) is used to login to SAP BTP this value is set to Orgin Key of the Custom Identity Provider`
72
+
64
73
> [!NOTE]
65
74
> We are using here a naming convention of Terraform to define the variable values. The file `terraform.tfvars` is used to define the variable values. The file is not checked into the source code repository. This is important to keep sensitive information out of the source code repository. When you run Terraform, it will automatically load the variable values from this file.
Copy file name to clipboardExpand all lines: released/SAP-Inside-Tracks/SITBLR_DEC_2024/exercises/EXERCISE2/README.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,6 +112,13 @@ As we have all variables in place, you should save the changes now.
112
112
> [!NOTE]
113
113
> 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.
114
114
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
+
115
122
### Step 2: Local values
116
123
117
124
Now we want to leverage the input variables to create a subaccount name that follows a specific naming convention. Here are the conditions:
Copy file name to clipboardExpand all lines: released/SAP-Inside-Tracks/SITBLR_DEC_2024/exercises/EXERCISE3/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ variable "bas_plan" {
36
36
}
37
37
```
38
38
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.
Add following variables to your `tfvars` file to configure the CloudFoundry Plan.
49
57
50
-
### Step 2: Adjust the output variables
58
+
```terraform
59
+
cf_plan = "trial"
60
+
```
61
+
Save the changes.
62
+
### Step 3: Adjust the output variables
51
63
52
64
As we are using the output variables, we need to adjust the output variables in the `outputs.tf` file. Open the `outputs.tf` file and add the following code:
Copy file name to clipboardExpand all lines: released/SAP-Inside-Tracks/SITBLR_DEC_2024/exercises/EXERCISE5/README.md
+33-69Lines changed: 33 additions & 69 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,29 +4,6 @@
4
4
5
5
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.
6
6
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:
> 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
-
30
7
To fulfill all requirements for the authentication against the Cloud Foundry environment you must export the following environment variables:
31
8
32
9
- Windows:
@@ -43,57 +20,39 @@ To fulfill all requirements for the authentication against the Cloud Foundry env
43
20
export CF_PASSWORD='<your SAP BTP password>'
44
21
```
45
22
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.
48
23
49
-
### Step 3: Apply the changes
24
+
### Step 1: Adjust the provider configuration
50
25
51
-
As we have a new provider in place, we need to re-initialize the setup to download the required providerand 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:
52
27
53
-
```bash
54
-
terraform init
28
+
```terraform
29
+
cloudfoundry = {
30
+
source = "cloudfoundry/cloudfoundry"
31
+
version = "1.1.0"
32
+
}
55
33
```
56
34
57
-
The output should look like this:
58
-
59
-
<imgwidth="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.
35
+
To configure the Cloud Foundry provider add the following lines at the end of the file:
The `origin` (Identity Provider Orgin Key ) is set to null. If a [Custom Identity Provider](https://help.sap.com/docs/btp/sap-business-technology-platform/log-on-with-custom-identity-provider-to-cloud-foundry-environment-using-cloud-foundry-command-line-interface) is used to login to SAP BTP CloudFoundry Environment, this value is set to Orgin Key of the Custom Identity Provider. The `api_url ` is the API URL of SAP BTP CloudFoundry Environment.
85
45
86
-
<img width="600px" src="assets/ex7_3.png" alt="executing terraform apply with cloud foundry provider">
87
46
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:
47
+
> [!WARNING]
48
+
> 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.
89
49
90
-
<img width="600px" src="assets/ex7_4.png" alt="SAP BTP Cockpit with Cloud Foundry environment">
91
50
92
-
## Creation of a Cloud Foundry space
51
+
> [!NOTE]
52
+
> 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.
93
53
94
-
As a last task we also want to add a Cloud Foundry space to the Cloud Foundry environment.
95
54
96
-
### Step 1: Add the variable to the configuration for Space creation
55
+
### Step 2: Add the variable to the configuration for Space creation
97
56
98
57
First we need to add more variable in the `variables.tf` file. Open the `variables.tf` file and add the following code:
99
58
@@ -131,7 +90,7 @@ variable "cf_space_auditors" {
131
90
132
91
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.
133
92
134
-
### Step 2: Cloudfoundry Space Creation and Role Assignments
93
+
### Step 3: Cloudfoundry Space Creation and Role Assignments
135
94
136
95
To trigger the creation of a Cloud Foundry space and space roles, Open the `main.tf` file and add the following code:
0 commit comments