Prerequisites
-
You must have Terraform CLI 1.14 or newer installed. Version 2 relies on Terraform list-resource queries and does not support OpenTofu. Make sure the
terraformbinary is in yourPATH. -
To export directories or subaccounts, you need to set the following environment variables to authenticate against SAP BTP:
| Environment Variable Name | Description |
|---|---|
| BTP_GLOBALACCOUNT | The subdomain of the global account from which you want to import resources. |
| BTP_USERNAME | Your user name, usually an e-mail address. |
| BTP_PASSWORD | Your password. Note that two-factor authentication is not supported. |
| BTP_TLS_CLIENT_CERTIFICATE | PEM encoded certificate (only required for x509 authentication) |
| BTP_TLS_CLIENT_KEY | PEM encoded private key (only required for x509 authentication) |
| BTP_TLS_IDP_URL | The URL of the identity provider to be used for authentication (only required for x509 authentication) |
| BTP_IDP | The identity provider to be used for authentication (only required for custom IDP) |
| BTP_CLI_SERVER_URL | The URL of the BTP CLI server (Relevant for SAP internal use-cases only) |
Release 1.7.0 and later
With release 1.7.0 we introduce the option to reuse the btp CLI login for authentication. The usage flow is as follows:
- Set the environment variable
USE_BTPCLI_SESSIONtotrue. - Login via btp CLI e.g, via
btp login --sso. - Optional: if you have a special path to your btp CLI configuration, set it via environment variable
BTPCLI_CONFIG_PATH.
Be aware that the feature is experimental (see documentation of Terraform Provider for SAP BTP).
Warning
Do not set the BTP_ENABLE_SSO parameter when using the btptf CLI. Processing will abort as this parameter is not supported.
The parameters are the ones required by the BTP Terraform Provider.
-
To export directories or subaccounts, you need global account administrator permissions.
-
To export Cloud Foundry orgs, you need to authenticate against Cloud Foundry by setting the following environment variables:
| Environment Variable Name | Description |
|---|---|
| CF_API_URL | Specific URL representing the entry point for communication between the client and a Cloud Foundry instance. |
| CF_USER | A unique identifier associated with an individual or entity for authentication & authorization purposes. |
| CF_PASSWORD | A confidential alphanumeric code associated with a user account on the Cloud Foundry platform, requires user to authenticate. |
| CF_ORIGIN | Indicates the identity provider to be used for login |
| CF_CLIENT_ID | Unique identifier for a client application used in authentication and authorization processes. |
| CF_CLIENT_SECRET | A confidential string used by a client application for secure authentication and authorization, requires cf_client_id to authenticate |
| CF_ACCESS_TOKEN | OAuth token to authenticate with Cloud Foundry |
| CF_REFRESH_TOKEN | Token to refresh the access token, requires access_token |
These environment variables are the ones required by the Terraform provider for Cloud Foundry.
- To export Cloud Foundry orgs, you need the Org Manager role.
How to set the parameters
Depending on your operating systems, you set the environment variables as follows:
$env:BTP_USERNAME=<MY SAP BTP USERNAME>
export BTP_USERNAME=<MY SAP BTP USERNAME>