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

Automating SAP HANA Cloud Tasks with the Terraform Provider for SAP BTP

Terraform is a tool that provides a declarative approach to provisioning and managing infrastructure.

Overview

🎓 intermediate 15 min. SAP HANA CloudIntermediateSAP HANA Cloud SAP HANA DatabaseSAP HANA Cloud Data Lake

You will learn

  • โœ”How to use the Terraform Provider for SAP BTP
  • โœ”How to create an SAP BTP subaccount that contains entitlements
  • โœ”How to create a subscription to SAP HANA Cloud Central
  • โœ”How to create and update one or more SAP HANA Cloud instances
Unknown U Unknown June 5, 2026
Created by May 6, 2024
Contributors

Prerequisites

Prerequisites

  • An SAP BTP account

Steps

Terraform
Terraform

When working with Terraform, a description of a target state is provided in a file named main.tf. Terraform will compare the last known state of the system to the target state and will determine the changes required. If the Terraform Provider for SAP BTP is being used to update the state of an instance, it is not recommended to also use other tools such as SAP HANA Cloud Central or the BTP CLI to make further updates. For additional details, see Drift Detection. The provider works with SAP HANA Cloud instances in a subaccount. If you wish to provision to Cloud Foundry, consider using the Cloud Foundry provider. See also https://registry.terraform.io/namespaces/SAP.

SAP Terraform Providers
SAP Terraform Providers

Step 1 Get started with Terraform and the Terraform Provider for SAP BTP
โ€”

  1. Download Terraform from Install Terraform.

    Extract the download into a folder such as C:\Terraform and add that folder to your path.

  2. Create a folder and a provider file. Replace notepad or pico with your favorite editor.

    Shell
    mkdir C:\HC_Terraform
    cd C:\HC_Terraform
    notepad provider.tf
    Shell
    mkdir ~/HC_Terraform
    cd ~/HC_Terraform
    pico provider.tf

    Terraform provides a registry of providers, one of which is the Terraform Provider for SAP BTP.

    Terraform Provider for SAP BTP
    Terraform Provider for SAP BTP

  3. Paste the following contents into provider.tf and save the file. This file will specify that we wish to use the Terraform Provider for SAP BTP, which version to use, and which global SAP BTP account to target. Details of what has changed between releases can be found on the Releases page.

    Terraform
    terraform {
      required_providers {
        btp = {
          source  = "SAP/btp"
          version = "~>1.3.0"
        }
      }
    }
    
    provider "btp" {
      globalaccount = "xxxxxxxx-8bb4-4df3-bd09-cc6e044fa174"
    }

    Update the value of globalaccount to match your account. This value can be obtained from the URL parameter in the SAP BTP Cockpit

  4. Initialize the project.

    Shell
    terraform init

    initialize the provider
    initialize the provider

For additional details, see Creating SAP HANA Cloud Instances Using Terraform and Basic CLI Features.

Step 2 Use Terraform to create a subaccount with entitlements for SAP HANA Cloud
+
Step 3 Use Terraform to subscribe to SAP HANA Cloud Central and assign a role collection
+
Step 4 Use Terraform to create an SAP HANA Cloud instance
+
Step 5 Use Terraform to add a label to an SAP HANA Cloud instance
+
Step 6 Use Terraform to update an SAP HANA Cloud instance
+
Step 7 Knowledge check
+

Resources

Discussion

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

Submit detailed feedback Discuss in Community
Steps
Step 1 of 7
1. Get started with Terraform and the Terraform Provider for SAP BTP 2. Use Terraform to create a subaccount with entitlements for SAP HANA Cloud 3. Use Terraform to subscribe to SAP HANA Cloud Central and assign a role collection 4. Use Terraform to create an SAP HANA Cloud instance 5. Use Terraform to add a label to an SAP HANA Cloud instance 6. Use Terraform to update an SAP HANA Cloud instance 7. Knowledge check

Learn more →