SAP / terraform-provider-btp

Terraform provider for SAP BTP
https://registry.terraform.io/providers/SAP/btp/latest
Apache License 2.0
89 stars 18 forks source link

fix: handling reset of secrets and certificates to NULL in the api-credential resources #951

Closed diya-dhan closed 1 week ago

diya-dhan commented 1 week ago

Purpose

fixes #949

Post the initial creation of the API credentials, any subsequent terraform apply resets the values of the certificates and secrets to null. This is occurs because the command btp get security/api-credential, does not return the secrets or the certificates of the created API credentials.

To address this, the Read function for each of the resources at all three levels (Subaccount, Directory and Globalaccount) have been modified to first retrieve the original values of the parameters (from the original state) before updating the state file. This change prevents the reset and ensures that the state file is consistent.

Does this introduce a breaking change?

[ ] Yes
[x] No

Pull Request Type

What kind of change does this Pull Request introduce?

[x] Bugfix
[ ] Feature
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

go test ./...

What to Check

Verify that the following are valid:

Checklist for reviewer

The following organizational tasks must be completed before merging this PR: