Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Aydin_Ozcan
Explorer
Terraform, where you can manage your infrastructure and keep your sanity at the same time. Often referred to as Infrastructure as Code (IoC), it allows you to provision and manage resources using code. I like to think of it as a stateful API manager and HTTP client that goes beyond cloud provisioning and can handle anything that exposes an API in a stateful manner.

In this blog post, I will introduce you to a Terraform module that I developed to simplify the management of entitlements: "sap-btp-entitlements". This module will reduce your code from a novel to a short story.

Terraform Modules: Your Blueprint for Infrastructure


Terraform modules are self-contained packages of Terraform configurations that act as building blocks for your infrastructure. They provide a way to encapsulate complexity and promote reusability across different projects. By creating a dedicated module for managing entitlements, we can simplify the overall Terraform codebase and improve its maintainability.

Entitlement Creation


Let's take a look at how traditional resource creation for entitlements would look like with the SAP BTP Terraform provider:
resource "btp_subaccount_entitlement" "application_logs" {
subaccount_id = btp_subaccount.acme.id
service_name = "application-logs"
plan_name = "lite"
}

resource "btp_subaccount_entitlement" "xsuaa" {
subaccount_id = btp_subaccount.acme.id
service_name = "xsuaa"
plan_name = "application"
}

resource "btp_subaccount_entitlement" "xsuaa_broker" {
subaccount_id = btp_subaccount.acme.id
service_name = "xsuaa"
plan_name = "broker"
}

# And so on, repeating this for every entitlement needed.

As you can see, for each service and each plan offered by the service, you need to create separate resources. This can lead to a considerable amount of repetitive code and increased chances of errors.

SAP BTP Entitlements Module


To address the challenges I have developed a Terraform module specifically for managing entitlements in SAP BTP. sap-btp-entitlements module provides elegant and efficient way to describe your entitlements. Let's take a look at how it works:
module "sap-btp-entitlements" {
source = "aydin-ozcan/sap-btp-entitlements/btp"
version = "1.0.1"

subaccount = "your subaccount id"

entitlements = {
"alert-notification" = ["standard"],
"application-logs" = ["lite"],
"xsuaa" = ["application", "broker"],
"kymaruntime" = ["trial=1"],
"APPLICATION_RUNTIME" = ["MEMORY=1"] # Cloud Foundry and Kyma needs to specify amount even if it is 1
}
}


With this module, you can specify your entitlements in a simple format, significantly reducing the amount of code you need to write. The module even allows you to set the amount for the entitlements; otherwise, it defaults to the service offerings' defaults.

How to Access and Use the Module


You can easily access and initialize the sap-btp-entitlements module from the Terraform registry.

The module's source code and additional usage examples can be found on GitHub at the following repository:

GitHub Repository - SAP BTP Entitlements

SAP BTP Terraform provider offers a robust solution for professional infrastructure management.
By utilizing sap-btp-entitlements you will :

  • Simplify the codebase.

  • Reduce the risk of errors.

  • Improve maintainability.

Labels in this area