SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Get Started with the Terraform Provider for BTP

Learn how to use Terraform to manage resources on SAP Business Technology Platform using code.

Overview

🎓 beginner 10 min. SAP Business Technology PlatformBeginnerCloud

You will learn

  • โœ”How to install and configure the Terraform Provider for BTP.
  • โœ”How to manage your BTP resources as code, making them more reproducible, maintainable, and scalable.
  • โœ”How to clean up your BTP resources when they are no longer needed, helping you avoid unnecessary costs and resource consumption.
Christian Volk C Christian Volk August 3, 2026
Created by July 27, 2023
Contributors

Prerequisites

Prerequisites

To follow along with this tutorial, ensure you have access to a free BTP trial account and Terraform installed on your machine. You can download it from the official Terraform website.

Steps

Terraform is an open-source tool that allows you to define and provide cloud infrastructure using a declarative configuration language. It helps in building, changing, and managing resources in a safe, consistent, and efficient manner.

By combining Terraform with SAP Business Technology Platform (BTP), you can programmatically manage your BTP environments.

Step 1 Setting up the Terraform Provider for BTP
โ€”

Create a new directory for the tutorial content. This directory will serve as the workspace for your Terraform configuration files. Afterwards, please open a terminal or command prompt and navigate to the newly created directory.

To install and configure the Terraform provider for BTP, add the following block to your Terraform configuration file (provider.tf).

HCL
terraform {
  required_providers {
    btp = {
      source  = "SAP/btp"
      version = "~>1.25.0"
    }
  }
}

provider "btp" {
  globalaccount = "4605efebtrial-ga"
}

Replace "4605efebtrial-ga" with the subdomain of your own BTP trial account.

After setting up the provider configuration, run the following command in the terminal to let Terraform download all necessary dependencies:

Shell
terraform init

terraform init
terraform init

Last but not least, you need to pass credentials to the provider to authenticate and interact with your BTP environments. Please set the environment variables BTP_USERNAME and BTP_PASSWORD.

For Windows you have two options to export the environment variables:

If you use Windows CMD, do the export via the following commands:

Shell
set BTP_USERNAME=<your_username>
set BTP_PASSWORD=<your_password>

If you use Powershell, do the export via the following commands:

Shell
$Env:BTP_USERNAME = '<your_username>'
$Env:BTP_PASSWORD = '<your_password>'

Replace &lt;your_username&gt; and &lt;your_password&gt; with your actual BTP username and password.

You are now ready to use the Terraform provider for BTP to manage your resources.

Step 2 Provisioning Subaccounts
+
Step 3 Managing Subaccount Entitlements
+
Step 4 Managing More Resources
+
Step 5 Destroying Resources with Terraform
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 5
1. Setting up the Terraform Provider for BTP 2. Provisioning Subaccounts 3. Managing Subaccount Entitlements 4. Managing More Resources 5. Destroying Resources with Terraform

Learn more →