Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
6e8402b
Update `terraform-plugin-go` dependency
SBGoods Aug 30, 2024
d30854f
Add `WriteOnly` attribute to schema and internal schema validation.
SBGoods Aug 30, 2024
17b4a61
Add `WriteOnly` validation for data source, provider, and provider me…
SBGoods Aug 30, 2024
5218321
Add WriteOnly capabilities validation to `ValidateResourceTypeConfig`…
SBGoods Aug 30, 2024
bb2bb08
Skip value validation for `Required` + `WriteOnly` attributes.
SBGoods Aug 30, 2024
1d70831
Fix intermittent test failures for `hasWriteOnly()`
SBGoods Aug 30, 2024
e7d79db
Validate non-null values for `Required` and `WriteOnly` attributes in…
SBGoods Sep 3, 2024
d171fb7
Add initial implementation for `PreferWriteOnlyAttribute()` validator
SBGoods Sep 5, 2024
25c2a13
Finish `PreferWriteOnlyAttribute()` validator implementation.
SBGoods Sep 9, 2024
2f917f8
Move `schema.ValidateResourceConfigFuncs` to `schema.Resource` and im…
SBGoods Sep 9, 2024
cab2a27
Add automatic state handling for writeOnly attributes
SBGoods Sep 10, 2024
6cc6811
Apply suggestions from code review
SBGoods Sep 16, 2024
994bc66
Wrap `setWriteOnlyNullValues` call in client capabilities check
SBGoods Sep 17, 2024
ff70638
Refactor tests to match diag summary changes
SBGoods Sep 17, 2024
c5c870d
Move write-only helper functions and tests to their own files.
SBGoods Sep 17, 2024
21cebbe
Refactor test attribute names for clarity
SBGoods Sep 17, 2024
a276ff4
Refactor `validateWriteOnlyNullValues()` to build an attribute path.`
SBGoods Sep 23, 2024
fac41b5
Refactor `validateWriteOnlyRequiredValues()` to build an attribute pa…
SBGoods Sep 23, 2024
7cf9024
Refactor field and function names based on PR feedback.
SBGoods Sep 23, 2024
d3a4926
Add clarifying comments.
SBGoods Sep 23, 2024
437577d
Add internal validation preventing data sources from defining `Valida…
SBGoods Sep 23, 2024
d5a7bd6
Change `writeOnlyAttributeName` parameter to use `cty.Path`
SBGoods Oct 3, 2024
5c2e2e2
Simplify validation condition logic
SBGoods Oct 3, 2024
1c21c96
Merge branch 'main' into SBGoods/write-only-attributes
SBGoods Nov 25, 2024
a5d8c2a
run `go mod tidy`
SBGoods Nov 25, 2024
3f32220
update `terraform-plugin-go` dependency
SBGoods Nov 25, 2024
28a5768
Add write-only support to `ProtoToConfigSchema()`
SBGoods Nov 26, 2024
2aec830
Nullify write-only attributes during Plan and Apply regardless of cli…
SBGoods Dec 3, 2024
1479d62
Introduce `(*ResourceData).GetRawWriteOnly()` and `(*ResourceData).Ge…
SBGoods Dec 17, 2024
18894a8
Revert "Introduce `(*ResourceData).GetRawWriteOnly()` and `(*Resource…
SBGoods Dec 17, 2024
20550b9
Introduce `(*ResourceData).GetRawConfigAt()` helper method for retrie…
SBGoods Dec 17, 2024
396b49b
null out write-only values
austinvalle Dec 18, 2024
e1dbbac
Return `diag.Diagnostics` instead of error for `(*ResourceData).GetRa…
SBGoods Dec 18, 2024
84b9873
Update `terraform-plugin-go` dependency
SBGoods Dec 18, 2024
0a9d11a
Add additional tests for automatic write-only value nullification
SBGoods Dec 18, 2024
6461314
Resolve linting errors and add copyright headers
SBGoods Dec 18, 2024
45cceb5
Merge branch 'main' into SBGoods/write-only-attributes
SBGoods Dec 18, 2024
0816d60
Remove "incorrect" test case
SBGoods Dec 18, 2024
e844e2d
Use `cty.DynamicVal` as default value for `GetRawConfigAt()`
SBGoods Dec 19, 2024
ec6675f
Throw validation error for computed blocks with write-only attributes
SBGoods Dec 19, 2024
f529da0
add `GetRawConfigAt` to `ResourceDiff` for usage in `CustomizeDiff` f…
austinvalle Jan 3, 2025
5f29273
unit tests for `ResourceDiff`
austinvalle Jan 3, 2025
c0d2bac
Add validation error for `WriteOnly` and `ForceNew`
SBGoods Jan 3, 2025
1dcc224
Add write-only value nullification to `ImportResourceState` and `Upgr…
SBGoods Jan 14, 2025
f831b07
Move `Required` + `WriteOnly` attribute validation to `ValidateResour…
SBGoods Jan 15, 2025
48b23cd
Merge remote-tracking branch 'origin/SBGoods/write-only-attributes' i…
SBGoods Jan 15, 2025
3e85928
Merge branch 'main' into SBGoods/write-only-attributes
SBGoods Jan 15, 2025
511005e
Add website documentation
SBGoods Jan 21, 2025
b6c06cf
Add changelog entries
SBGoods Jan 21, 2025
36978c5
Update `terraform-plugin-go` dependency to `v0.24.0`
SBGoods Jan 22, 2025
33b7ee4
Replace fully qualified links with relative links in website document…
SBGoods Jan 22, 2025
d1d4c14
Add more test cases for `GetRawConfigAt()`
SBGoods Jan 22, 2025
1b935c4
Add link to ephemeral resource documentation
SBGoods Jan 22, 2025
5070aeb
Apply suggestions from code review
SBGoods Jan 24, 2025
4b5b363
Apply suggestions from code review
SBGoods Jan 24, 2025
c1a1556
Fix write-only attribute error assertions
SBGoods Jan 24, 2025
d40b6b0
Prevent `WriteOnly` from being used with `Default` and `DefaultFunc`.
SBGoods Jan 24, 2025
6d9ab94
Update error messaging
SBGoods Jan 24, 2025
91bc003
Add null value test case
SBGoods Jan 24, 2025
2c0793b
Rename "write-only attributes" to "write-only arguments" in website d…
SBGoods Jan 24, 2025
099130f
Add configuration examples to `cty.Path` documentation
SBGoods Feb 3, 2025
74dccee
Merge branch 'main' into SBGoods/write-only-attributes
SBGoods Feb 3, 2025
e58d5e3
Add changelog entry for `ValidateRawResourceConfigFuncs`
SBGoods Feb 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
module github.com/hashicorp/terraform-plugin-sdk/v2

go 1.21
go 1.22

toolchain go1.21.6
toolchain go1.22.6

require (
github.com/google/go-cmp v0.6.0
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/go-hclog v1.6.3
github.com/hashicorp/go-plugin v1.6.0
github.com/hashicorp/go-plugin v1.6.1
github.com/hashicorp/go-uuid v1.0.3
github.com/hashicorp/go-version v1.7.0
github.com/hashicorp/hc-install v0.8.0
github.com/hashicorp/hcl/v2 v2.22.0
github.com/hashicorp/logutils v1.0.0
github.com/hashicorp/terraform-exec v0.21.0
github.com/hashicorp/terraform-json v0.22.1
github.com/hashicorp/terraform-plugin-go v0.23.0
github.com/hashicorp/terraform-plugin-go v0.23.1-0.20240830180900-5eafe6ae6def
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/mitchellh/copystructure v1.2.0
github.com/mitchellh/go-testing-interface v1.14.1
Expand Down Expand Up @@ -55,7 +55,7 @@ require (
golang.org/x/text v0.17.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/protobuf v1.34.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
)
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB1
github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A=
github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI=
github.com/hashicorp/go-plugin v1.6.1 h1:P7MR2UP6gNKGPp+y7EZw2kOiq4IR9WiqLvp0XOsVdwI=
github.com/hashicorp/go-plugin v1.6.1/go.mod h1:XPHFku2tFo3o3QKFgSYo+cghcUhw1NA1hZyMK0PWAw0=
github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU=
github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
Expand All @@ -74,8 +74,8 @@ github.com/hashicorp/terraform-exec v0.21.0 h1:uNkLAe95ey5Uux6KJdua6+cv8asgILFVW
github.com/hashicorp/terraform-exec v0.21.0/go.mod h1:1PPeMYou+KDUSSeRE9szMZ/oHf4fYUmB923Wzbq1ICg=
github.com/hashicorp/terraform-json v0.22.1 h1:xft84GZR0QzjPVWs4lRUwvTcPnegqlyS7orfb5Ltvec=
github.com/hashicorp/terraform-json v0.22.1/go.mod h1:JbWSQCLFSXFFhg42T7l9iJwdGXBYV8fmmD6o/ML4p3A=
github.com/hashicorp/terraform-plugin-go v0.23.0 h1:AALVuU1gD1kPb48aPQUjug9Ir/125t+AAurhqphJ2Co=
github.com/hashicorp/terraform-plugin-go v0.23.0/go.mod h1:1E3Cr9h2vMlahWMbsSEcNrOCxovCZhOOIXjFHbjc/lQ=
github.com/hashicorp/terraform-plugin-go v0.23.1-0.20240830180900-5eafe6ae6def h1:/RKsl9EoVaSGf4PgyuDEmnPd2f/x2jdntwx+q0kY2xA=
github.com/hashicorp/terraform-plugin-go v0.23.1-0.20240830180900-5eafe6ae6def/go.mod h1:ko0HcPe7AkwMukddKa13Qq5zyvi8V9KYxBZmqU8a9cE=
github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0=
github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow=
github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI=
Expand Down Expand Up @@ -194,14 +194,14 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY=
google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM=
google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc=
google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4=
google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
1 change: 1 addition & 0 deletions helper/schema/core_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ func (s *Schema) coreConfigSchemaAttribute() *configschema.Attribute {
Description: desc,
DescriptionKind: descKind,
Deprecated: s.Deprecated != "",
WriteOnly: s.WriteOnly,
}
}

Expand Down
19 changes: 19 additions & 0 deletions helper/schema/core_schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,25 @@ func TestSchemaMapCoreConfigSchema(t *testing.T) {
BlockTypes: map[string]*configschema.NestedBlock{},
}),
},
"write-only": {
map[string]*Schema{
"string": {
Type: TypeString,
Optional: true,
WriteOnly: true,
},
},
testResource(&configschema.Block{
Attributes: map[string]*configschema.Attribute{
"string": {
Type: cty.String,
Optional: true,
WriteOnly: true,
},
},
BlockTypes: map[string]*configschema.NestedBlock{},
}),
},
}

for name, test := range tests {
Expand Down
Loading