Conversation
|
There was a problem hiding this comment.
Pull request overview
Fixes inconsistent Terraform apply behavior for computed SAP-managed attributes (notably saml2Configuration.digestAlgorithm) by allowing null state to be planned/updated correctly.
Changes:
- Switches multiple computed/optional attributes to
UseNonNullStateForUnknown()plan modifiers. - Adds
UseNonNullStateForUnknown()plan modifiers for severalInt32andStringattributes. - Adjusts SAML2 config state mapping to only set certain fields when non-empty.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| sci/provider/type_application.go | Updates SAML2 attribute mapping to avoid forcing empty values into state. |
| sci/provider/resource_application.go | Replaces UseStateForUnknown() with UseNonNullStateForUnknown() and adds missing plan modifiers to improve null-handling for computed attributes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if len((saml2Res.DefaultNameIdFormat)) > 0 { | ||
| saml2Config.DefaultNameIdFormat = types.StringValue(reflect.ValueOf(saml2Res.DefaultNameIdFormat).String()) | ||
| } |
There was a problem hiding this comment.
reflect.ValueOf(...).String() is risky here: if DefaultNameIdFormat is not a string kind (e.g., a *string or custom type), this will not yield the desired value (and can produce a placeholder like "<*string Value>"). Since this field was previously passed directly to types.StringValue(...), set it directly (or explicitly dereference/convert based on the actual type) and drop the redundant extra parentheses in len((...)). This avoids potential incorrect state values for default_name_id_format.
| saml2Config.SamlMetadataUrl = types.StringValue(saml2Res.SamlMetadataUrl) | ||
| } | ||
|
|
||
| // Saml Digest Algorithm |
There was a problem hiding this comment.
The acronym should be capitalized as SAML in these comments for consistency (SAML Digest Algorithm, SAML Default NameId Format).
| saml2Config.DigestAlgorithm = types.StringValue(saml2Res.DigestAlgorithm) | ||
| } | ||
|
|
||
| // Saml Default NameId Format |
There was a problem hiding this comment.
The acronym should be capitalized as SAML in these comments for consistency (SAML Digest Algorithm, SAML Default NameId Format).



Purpose
Closes #260 #261
When performing a GET operation on any SAP managed application, the attribute
saml2Configuration.digestAlgorithmunless the application is updated via a PUT call. This leads to an inconsistent apply when updates are executed.This is overcome by modifying the plan modifier of the attribute such that the
nullvalue can be updated. The plan modifiers for a few other attributes have been modified as well.Does this introduce a breaking change?
Pull Request Type
What kind of change does this Pull Request introduce?
How to Test
make testWhat to Check
Verify that the following are valid:
Checklist for reviewer
The following organizational tasks must be completed before merging this PR: