Prerequisite
After executing the setup of the btptf CLI, you must set some required environment variables needed for authentication.
-
Set the environment variable
BTP_GLOBALACCOUNT
which specifies the subdomain of your SAP BTP global account. -
Depending on the authentication flow, set the following environment variables:
- Basic Authentication: set the environment variable
BTP_USERNAME
andBTP_PASSWORD
- X509 Authentication: set the environment variables
BTP_TLS_CLIENT_CERTIFICATE
,BTP_TLS_CLIENT_KEY
,BTP_TLS_IDP_URL
- Basic Authentication: set the environment variable
-
In addition you can set the following optional parameters as environment variables, depending on your requirements:
- Specify a custom IdP for the authentication via
BTP_IDP
- Specify a URL of the BTP CLI server (SAP internal only) via
BTP_CLI_SERVER_URL
- Specify the login using SSO via
BTP_ENABLE_SSO
(true/false)
- Specify a custom IdP for the authentication via
The parameters correspond to the Terraform provider configuration options that you find in the BTP Terraform Provider documentation
How to set the parameters depends on your setup and is OS-specific:
$env:BTP_USERNAME=<MY SAP BTP USERNAME>
export BTP_USERNAME=<MY SAP BTP USERNAME>
-
In a devcontainer:
- Create a file
devcontainer.env
in the.devcontainer
directory - Add the environment variables in the file. Here is an example:
- Start the devcontainer optionBTP_USERNAME='<MY SAP BTP USERNAME>' BTP_PASSWORD='<MY SAP BTP PASSWORD>' BTP_GLOBALACCOUNT='<MY SAP BTP GLOBAL ACCOUNT SUBDOMAIN>' #optional
Terraform exporter for SAP BTP - Development (with env file)
. The environment variables defined in thedevcontainer.env
file will be automatically injected.- Alternative via
.env
file (available on MacOS and Linux only): - Create a file
.env
in the root of the project - Add the environment variables in the file. Here is an example:
BTP_USERNAME='<MY SAP BTP USERNAME>' BTP_PASSWORD='<MY SAP BTP PASSWORD>' BTP_GLOBALACCOUNT='<MY SAP BTP GLOBAL ACCOUNT SUBDOMAIN>'
- Execute the following command in a terminal:
export $(xargs <.env)
- Create a file
Info
There is no predefined functionality in PowerShell to achieve the same. A custom script is needed.