Skip to content

Commit

Permalink
Add write-only attributes data_wo and binary_data_wo to kubernete…
Browse files Browse the repository at this point in the history
…s_secret_v1 (#2692)
  • Loading branch information
jrhouston authored Feb 26, 2025
1 parent 8aa8b4d commit c2d1214
Show file tree
Hide file tree
Showing 9 changed files with 397 additions and 82 deletions.
3 changes: 3 additions & 0 deletions .changelog/2692.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
`resource/kubernetes_secret_v1`: Add support for write only attributes for `data_wo` and `binary_data_wo`.
```
10 changes: 5 additions & 5 deletions .github/workflows/acceptance_tests_kind.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
default: "^TestAcc"
terraformVersion:
description: Terraform version
default: 1.10.1
default: 1.11.0-rc1 # FIXME change this v1.11.0 is released
parallelRuns:
description: The maximum number of tests to run simultaneously
default: 8
Expand All @@ -29,8 +29,8 @@ env:
KUBECONFIG: ${{ github.workspace }}/.kube/config
KIND_VERSION: ${{ github.event.inputs.kindVersion || '0.25.0' }}
PARALLEL_RUNS: ${{ github.event.inputs.parallelRuns || '8' }}
TERRAFORM_VERSION: ${{ github.event.inputs.terraformVersion || '1.10.1' }}

TERRAFORM_VERSION: ${{ github.event.inputs.terraformVersion || '1.11.0-rc1' }} # FIXME change when v1.11.0 is released
jobs:
acceptance_tests_kind:
if: ${{ github.repository_owner == 'hashicorp' }}
Expand All @@ -56,11 +56,11 @@ jobs:
# include if reference is v3-major-release and base reference is not v3-major-release
- isMajorReleaseBranch: true
isBaseMajorRelease: false
kubernetes_version: v1.31.2@sha256:33034c0a75dd82b2f2f22bdf0a30ea2a42b2c3547a6d56c52c7ea9c1b5fb89b9
kubernetes_version: v1.31.4@sha256:2cb39f7295fe7eafee0842b1052a599a4fb0f8bcf3f83d96c7f4864c357c6c30
# include if reference is not v3-major-release and base reference is v3-major-release
- isMajorReleaseBranch: false
isBaseMajorRelease: true
kubernetes_version: v1.31.2@sha256:33034c0a75dd82b2f2f22bdf0a30ea2a42b2c3547a6d56c52c7ea9c1b5fb89b9
kubernetes_version: v1.31.4@sha256:2cb39f7295fe7eafee0842b1052a599a4fb0f8bcf3f83d96c7f4864c357c6c30
steps:
- name: Checkout repository
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/manifest_acc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ jobs:
# include if reference is v3-major-release and base reference is not v3-major-release
- isMajorReleaseBranch: true
isBaseMajorRelease: false
kubernetes_version: v1.31.2@sha256:33034c0a75dd82b2f2f22bdf0a30ea2a42b2c3547a6d56c52c7ea9c1b5fb89b9
kubernetes_version: v1.31.4@sha256:2cb39f7295fe7eafee0842b1052a599a4fb0f8bcf3f83d96c7f4864c357c6c30
# include if reference is not v3-major-release and base reference is v3-major-release
- isMajorReleaseBranch: false
isBaseMajorRelease: true
kubernetes_version: v1.31.2@sha256:33034c0a75dd82b2f2f22bdf0a30ea2a42b2c3547a6d56c52c7ea9c1b5fb89b9
kubernetes_version: v1.31.4@sha256:2cb39f7295fe7eafee0842b1052a599a4fb0f8bcf3f83d96c7f4864c357c6c30
terraform_version:
- 1.9.8
- 1.8.5
Expand Down
4 changes: 4 additions & 0 deletions docs/resources/secret_v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ The resource provides mechanisms to inject containers with sensitive information

- `binary_data` (Map of String, Sensitive) A map of the secret data in base64 encoding. Use this for binary data.
- `data` (Map of String, Sensitive) A map of the secret data.
- `binary_data_wo` (Map of String, Write-Only) BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet. This field only accepts base64-encoded payloads that will be decoded/encoded before being sent/received to/from the apiserver.
- `binary_data_wo_revision` (Number) The current revision of the write-only "binary_data_wo" attribute. Incrementing this integer value will cause Terraform to update the write-only value.`
- `data_wo` (Map of String, Write-Only) Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process.
- `data_wo_revision` (Number) The current revision of the write-only "data_wo" attribute. Incrementing this integer value will cause Terraform to update the write-only value.`
- `immutable` (Boolean) Ensures that data stored in the Secret cannot be updated (only object metadata can be modified).
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
- `type` (String) Type of secret
Expand Down
40 changes: 20 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ require (
github.com/hashicorp/go-hclog v1.6.3
github.com/hashicorp/go-plugin v1.6.2
github.com/hashicorp/go-version v1.7.0
github.com/hashicorp/hc-install v0.9.0
github.com/hashicorp/hc-install v0.9.1
github.com/hashicorp/hcl/v2 v2.23.0
github.com/hashicorp/terraform-exec v0.21.0
github.com/hashicorp/terraform-json v0.23.0
github.com/hashicorp/terraform-exec v0.22.0
github.com/hashicorp/terraform-json v0.24.0
github.com/hashicorp/terraform-plugin-docs v0.16.0
github.com/hashicorp/terraform-plugin-framework v1.13.0
github.com/hashicorp/terraform-plugin-go v0.25.0
github.com/hashicorp/terraform-plugin-go v0.26.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-mux v0.17.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.35.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.0
github.com/hashicorp/terraform-plugin-testing v1.11.0
github.com/jinzhu/copier v0.3.5
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/hashstructure v1.1.0
github.com/robfig/cron v1.2.0
github.com/stretchr/testify v1.8.3
golang.org/x/mod v0.21.0
golang.org/x/mod v0.22.0
k8s.io/api v0.28.6
k8s.io/apiextensions-apiserver v0.28.6
k8s.io/apimachinery v0.28.6
Expand All @@ -42,7 +42,7 @@ require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/ProtonMail/go-crypto v1.1.0-alpha.2 // indirect
github.com/ProtonMail/go-crypto v1.1.3 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
Expand All @@ -62,9 +62,9 @@ require (
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect
golang.org/x/sync v0.9.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect
)

require (
Expand All @@ -78,7 +78,7 @@ require (
github.com/fatih/camelcase v1.0.0 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
Expand All @@ -96,7 +96,7 @@ require (
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
github.com/hashicorp/terraform-registry-address v0.2.4 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/imdario/mergo v0.3.15 // indirect
Expand Down Expand Up @@ -126,18 +126,18 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/xlab/treeprint v1.2.0 // indirect
github.com/zclconf/go-cty v1.15.0
github.com/zclconf/go-cty v1.16.2
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
golang.org/x/crypto v0.29.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.26.0 // indirect
golang.org/x/text v0.20.0 // indirect
golang.org/x/crypto v0.32.0 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/term v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/grpc v1.67.1
google.golang.org/protobuf v1.35.1 // indirect
google.golang.org/grpc v1.69.4
google.golang.org/protobuf v1.36.3 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit c2d1214

Please sign in to comment.