Skip to content

Commit 38f7358

Browse files
docs: customdiff.{ValidateChange,ForceNewIfChange,ComputedIf} take a context.Context (#1022)
1 parent 6dc86a7 commit 38f7358

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

helper/customdiff/compose.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
// &schema.Resource{
2222
// // ...
2323
// CustomizeDiff: customdiff.All(
24-
// customdiff.ValidateChange("size", func (old, new, meta interface{}) error {
24+
// customdiff.ValidateChange("size", func (ctx context.Context, old, new, meta interface{}) error {
2525
// // If we are increasing "size" then the new value must be
2626
// // a multiple of the old value.
2727
// if new.(int) <= old.(int) {
@@ -32,12 +32,12 @@ import (
3232
// }
3333
// return nil
3434
// }),
35-
// customdiff.ForceNewIfChange("size", func (old, new, meta interface{}) bool {
35+
// customdiff.ForceNewIfChange("size", func (ctx context.Context, old, new, meta interface{}) bool {
3636
// // "size" can only increase in-place, so we must create a new resource
3737
// // if it is decreased.
3838
// return new.(int) < old.(int)
3939
// }),
40-
// customdiff.ComputedIf("version_id", func (d *schema.ResourceDiff, meta interface{}) bool {
40+
// customdiff.ComputedIf("version_id", func (ctx context.Context, d *schema.ResourceDiff, meta interface{}) bool {
4141
// // Any change to "content" causes a new "version_id" to be allocated.
4242
// return d.HasChange("content")
4343
// }),

website/docs/plugin/sdkv2/resources/customizing-differences.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func resourceExampleInstance() *schema.Resource {
3939
},
4040
},
4141
CustomizeDiff: customdiff.All(
42-
customdiff.ValidateChange("size", func (old, new, meta any) error {
42+
customdiff.ValidateChange("size", func (ctx context.Context, old, new, meta any) error {
4343
// If we are increasing "size" then the new value must be
4444
// a multiple of the old value.
4545
if new.(int) <= old.(int) {
@@ -50,7 +50,7 @@ func resourceExampleInstance() *schema.Resource {
5050
}
5151
return nil
5252
}),
53-
customdiff.ForceNewIfChange("size", func (old, new, meta any) bool {
53+
customdiff.ForceNewIfChange("size", func (ctx context.Context, old, new, meta any) bool {
5454
// "size" can only increase in-place, so we must create a new resource
5555
// if it is decreased.
5656
return new.(int) < old.(int)

0 commit comments

Comments
 (0)