feat: Add binary data support for secrets#154
Open
freeznet wants to merge 4 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds Terraform provider support for supplying write-only base64-encoded binary secret data, backed by updated StreamNative API dependencies.
Changes:
- Adds
binary_dataschema, validation, state preservation, and secret payload construction. - Updates docs and examples to show binary secret usage.
- Updates related dependencies and adds unit coverage for binary secret behavior.
Reviewed changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
cloud/resource_secret.go |
Adds binary_data resource support and duplicate key validation. |
cloud/provider.go |
Adds the binary_data attribute description. |
cloud/secret_state_test.go |
Adds unit tests for binary data schema, validation, and state behavior. |
docs/resources/secret.md |
Documents the new binary_data resource attribute. |
examples/secrets/main.tf |
Updates the secret example to use string_data and binary_data. |
go.mod |
Updates API/operator dependencies needed for binary secret support. |
go.sum |
Updates checksums for dependency changes. |
.gitignore |
Ignores root-level PLAN.md. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+42
to
+43
| binary_data = { | ||
| "cert.p12" = filebase64("./cert.p12") |
Comment on lines
+227
to
+239
| seen := make(map[string]string) | ||
| for _, field := range []string{"data", "string_data", "binary_data"} { | ||
| keys, configured := configuredSecretDataKeys(diff, field) | ||
| if !configured { | ||
| continue | ||
| } | ||
| for key := range keys { | ||
| if existingField, ok := seen[key]; ok { | ||
| return fmt.Errorf("secret data key %q is configured in both %q and %q", key, existingField, field) | ||
| } | ||
| seen[key] = field | ||
| } | ||
| } |
Comment on lines
+337
to
+340
| if includeUnset || d.HasChange("binary_data") { | ||
| if binaryDataRaw, ok := d.GetOk("binary_data"); ok { | ||
| secret.BinaryData = convertToStringMap(binaryDataRaw.(map[string]interface{})) | ||
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.