cancel
Showing results for 
Search instead for 
Did you mean: 

Bad Request Error while creating SAP BTP Process Integration Runtime instance using Terraform

kriba_deloitte
Explorer
220

My Goal - To create and maintain SAP BTP infrastructure like Directory, Subaccounts, Cloud Foundry subscription, Process Integration Runtime instance, Role Collections, Roles, etc for transformation projects using Terraform

What I have accomplished so far - I have managed to use Terraform to create Directory, Subaccounts, Cloud Foundry subscription and assign Process Integration Runtime entitlement to the subaccount, but while creating an instance, its throwing a Bad Request error.

The Code - 

 

data "btp_subaccount_service_plan" "pir_service_plan" {
  subaccount_id = var.subaccount_id
  name          = btp_subaccount_entitlement.pir_entl.service_name
  offering_name = btp_subaccount_entitlement.pir_entl.plan_name
}
 
resource "btp_subaccount_service_instance" "pir" {
  subaccount_id = var.subaccount_id  
  # The service plan ID can be looked up via the data source btp_subaccount_service_plan
  serviceplan_id = <<This ID is what I need from the previous Data resource>>
  name           = "pir-${var.subaccount_id}"

  parameters = jsonencode({
"roles": [
       <<Role1>>,
       <Role2>>
    ],
    "grant-types": [
        "client_credentials"
    ],
    "redirect-uris": [],
    "token-validity": 43200

  })
}

 

 

Essentially, I am trying to use the resource "btp_subaccount_service_instance" to create an instance of Process Integration Runtime. But for this I need the serviceplan_Id, which I should be able to get using the data source "btp_subaccount_service_plan". 

 

But no matter what data I pass to this data source I get the following error - 

Planning failed. Terraform encountered an error while generating this plan.

Error: API Error Reading Resource Service Plan (Subaccount) with module.process_integration_runtime.data.btp_subaccount_service_plan.service_plans, on modules/process_integration_runtime/process_integration_runtime.tf line 59, in data "btp_subaccount_service_plan" "service_ 59: data "btp_subaccount_service_plan" "service_plans" { │ │ BadRequest ╵ Operation failed: failed running terraform plan (exit 1) 

Currently, I am passing "it-rt" as the name parameter and "api" as the offering_name parameter. No matter what value I give, it's always throwing me an error.  And the error description isn't detailed enough to debug!

Any help is greatly appreciated

---------------------------------------------------------------------------------------------------------------------------------------------Additional info (09-02-2025)

I started to think maybe this was a back-end issue. To test this, I used btp cli to access the subaccount and check the available services that I was entitled to use and voila - I don't see Process Integration Runtime

BTP CLI - services_offering.png

This leads me to think that the APIs are not able to find a process integration runtime service entitlement at all! I checked in the UI and I can see this service entitlement added to the subaccount. 

BTP - service entitlement.png

Should I raise an SAP ticket for this?

Thanks

Kriba

Accepted Solutions (0)

Answers (0)