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
description = "The name of the cloudfoundry org connected to the project account."
56
67
}
57
68
```
58
-
59
-
### Step 4: Adjust the provider configuration
60
-
61
-
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:
62
-
63
-
```terraform
64
-
cloudfoundry = {
65
-
source = "cloudfoundry/cloudfoundry"
66
-
version = "1.1.0"
67
-
}
68
-
```
69
-
70
-
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.
81
-
82
-
To fulfill all requirements for the authentication against the Cloud Foundry environment you must export the following environment variables:
83
-
84
-
- Windows:
85
-
86
-
```pwsh
87
-
$env:CF_USER=<your SAP BTP username>
88
-
$env:CF_PASSWORD='<your SAP BTP password>'
89
-
```
90
-
91
-
- Linux/MacOS/GitHub Codespaces:
92
-
93
-
```bash
94
-
export CF_USER=<your SAP BTP username>
95
-
export CF_PASSWORD='<your SAP BTP password>'
96
-
```
97
-
98
-
> [!NOTE]
99
-
> 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.
100
-
101
69
### Step 3: Apply the changes
102
70
103
-
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:
104
-
105
-
```bash
106
-
terraform init
107
-
```
108
-
109
-
The output should look like this:
110
-
111
-
<imgwidth="600px"src="assets/ex7_1.png"alt="executing terraform init with cloud foundry provider">
112
-
113
-
> [!NOTE]
114
-
> 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.
115
-
116
-
You know the drill by now:
117
-
118
71
1. Plan the Terraform configuration to see what will be created:
119
72
120
73
```bash
@@ -132,153 +85,8 @@ You know the drill by now:
132
85
```
133
86
134
87
You will be prompted to confirm the creation of the environment. Type `yes` and press `Enter` to continue.
135
-
136
-
The result should look like this:
137
-
138
-
<img width="600px" src="assets/ex7_3.png" alt="executing terraform apply with cloud foundry provider">
139
-
140
-
You can also check that everything is in place via the SAP BTP cockpit. You should see the Cloud Foundry environment in the subaccount:
141
-
142
-
<img width="600px" src="assets/ex7_4.png" alt="SAP BTP Cockpit with Cloud Foundry environment">
143
-
144
-
## Creation of a Cloud Foundry space
145
-
146
-
As a last task we also want to add a Cloud Foundry space to the Cloud Foundry environment.
147
-
148
-
### Step 1: Add the variable to the configuration for Space creation
149
-
150
-
First we need to add more variable in the `variables.tf` file. Open the `variables.tf` file and add the following code:
151
-
152
-
```terraform
153
-
variable "cf_space_name" {
154
-
type = string
155
-
description = "The name of the Cloud Foundry space."
156
-
default = "dev"
157
-
}
158
-
159
-
variable "cf_landscape_label" {
160
-
type = string
161
-
description = "The region where the project account shall be created in."
162
-
default = "cf-us10-001"
163
-
}
164
-
165
-
variable "cf_org_name" {
166
-
type = string
167
-
description = "The name for the Cloud Foundry Org."
168
-
default = ""
169
-
}
170
-
171
-
variable "cf_org_user" {
172
-
type = set(string)
173
-
description = "Defines the colleagues who are added to each subaccount as subaccount administrators."
0 commit comments