Repository navigation
Description
Is there an existing issue for this?
- I have searched the existing issues
What version of the Terraform exporter are you using?
2.0.0
What version of the Terraform CLI CLI are you using?
1.17.2
What type of issue are you facing
bug report
Describe the bug
We have two subaccount-level, multi-environment SAP Hana Cloud instances running in one Subaccount. Since they were created using the multi-environment model they show "other environment" in the BTP Cockpit. When the exporter encounters those services it tries to "modify" them, which the associated user is not allowed to do. Since i am not able to reproduce the issue on a trial subaccount or another subaccount i cannot estimate the impact those modification would have. So i want to ask whether that is an intended behavior and the impact the modification has.
This is an excerpt from terraform plan for one of those services, i have manually redacted values:
# btp_subaccount_service_instance.serviceinstance_16 will be updated in-place
# (will be imported first)
~ resource "btp_subaccount_service_instance" "serviceinstance_16" {
~ context = jsonencode(
{
- crm_customer_id = "<redacted>"
- env_type = "sapcp"
- global_account_id = "<redacted>"
- instance_name = "<redacted>"
- license_type = "CUSTOMER"
- origin = "sapcp"
- platform = "sapcp"
- region = "cf-eu10"
- subaccount_id = "<redacted>"
- subdomain = "<redacted>"
- zone_id = "<redacted>"
}
) -> (known after apply)
~ created_date = "2023-10-15T10:30:31Z" -> (known after apply)
~ dashboard_url = "<redacted>.prod-eu10.hanacloud.ondemand.com" -> (known after apply)
id = "<redacted>"
~ labels = {} -> (known after apply)
~ last_modified = "2026-11-15T03:00:08Z" -> (known after apply)
name = "<redacted>"
- parameters = (sensitive value) -> null
~ platform_id = "service-manager" -> (known after apply)
~ ready = true -> (known after apply)
~ referenced_instance_id = null -> (known after apply)
serviceplan_id = "<redacted>"
shared = false
~ state = "succeeded" -> (known after apply)
subaccount_id = "<redacted>"
~ usable = true -> (known after apply)
}
}
There are things that concern me. For example -parameters =(sensitive value)-> null
Expected Behavior
No response
Steps To Reproduce
- create multi-environment SAP HANA Cloud Instance
- run btptf export
- run bptf plan -> will show service instance change
User's Role Collections
No response
Add screenshots to help explain your problem
No response
Additional context
No response
Activity
lechnerc77 commentedon Nov 18, 2026
@TimK200 Does this import impact services with parameters only? From you plan the change is triggered due to the missing parameters:
If yes, this is a known gap in the Terraform provider (see https://github.com/SAP/terraform-provider-btp/blob/main/guides/IMPORT.md), as we cannot consistently fetch the parameters from the platform. Can you check?
TimK200 commentedon Nov 19, 2026
Every resource where terraform plan fails (in our testing cf environments) has a parameter "status" that terraform wants to set to "ACTIVE". Looking at the import block shows the parameter present and set to ACTIVE. BTP Cockpit also shows that parameter set.
The documentation states:
"Service instances with parameters: The import of service instances configured via parameters only works if the corresponding service offering supports parameter retrieval (instances_retrievable set to true). If parameters are not retrievable from the backend API, ensure you declare parameters in your resource block matching the existing state to prevent unintended configuration drift during terraform plan."
If that is the issue how come the exporter can retrieve the parameters correctly but the provider fails?
lechnerc77 commentedon Nov 19, 2026
@TimK200 I am noit sure if I understand the additional information:
in our testing cf environments-> We are talking about resources living in BTP (environment other) or on CF or on both?parameter "status"-> the atrtributestateis a computed field of the resource. The change in the original code you shared is due to the change of the parametersparameters-> The attributeparameters(= the JSON string with service specific configuration parameters) is the one that causes the in-place update during the import: this is the information taht we cannot fetch from the backend at least not consistently for all services. The provider does not read that field from the backend due that inconsistency.I will reprodue your setup and provide more details on the flow and its issues here.
TimK200 commentedon Nov 19, 2026
okay maybe i should have added the context properly. In other cases, not the one provided in the initial description, we ran into the issue when terraform plan tried to modify the btp_subaccount_environment_instance (in our case a cloudfoundry env). The resource was, from what we can tell, correctly exported and written in a resource block (with the parameter status="ACTIVE").
From btp_resources.tf:
Terraform plan then wants to modify it, trying to add the parameter. Which you described is the issue with unreliable retrieval.
How would we go about working around that issue?
The documentation talks about strictly matching the parameters in the resource-block with the live backend config. Since the resource-block after the export has the correct parameters i assume this is "valid" according to the doc? I am looking at the documentation you posted for the service_instance even though this is a different resource. The documentation for subaccount_environmental_instance has no mention for these kind of issues.
Fyi: A older versions of Terraform(1.15.8) that we had in use had no issue with the environment_instances but with the initial issue with the services.
lechnerc77 commentedon Nov 19, 2026
@TimK200 Thanks for the clarification, I will investigate in scenarios and come back to you
lechnerc77 commentedon Nov 19, 2026
@TimK200 as promised the update:
The clean-up of the environment instance parameters is implemented in #669 and will be part of the next release. For the time beeing you can just remove the line
status = "ACTIVE"from your Terraform configuration.The behavior of the service instance is caused by the reason already discussed. The main issue is the attribute
parametersof the resourcebtp_service_instance(https://registry.terraform.io/providers/SAP/btp/latest/docs/resources/subaccount_service_instance#parameters-1). Two main cases need to be distinguished:The gap of scenario 2 is known and cannot be fixed by the exporter or the Terraform provider. This is an issue with the platform and must be fixed by the services.
Bottom-line: when importing service instances you must carefully check for the in-place updates and test the import process when providing the parameters. There is no better approach as of today and as staed nothing we can fix from the Terraform team side.
As we cannot provide a solutin for this gap I will close the issue