Skip to content

Commit 59b5dfc

Browse files
authored
Merge pull request #44609 from hashicorp/f-list-vpcs
list-resource/aws_vpc
2 parents 728fea4 + 8627358 commit 59b5dfc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1861
-163
lines changed

.ci/semgrep/tflog/tflog.go

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package main
2+
3+
import (
4+
"context"
5+
6+
"github.com/hashicorp/terraform-plugin-log/tflog"
7+
)
8+
9+
func noAssignment() {
10+
ctx := context.Background()
11+
12+
// ruleid: setfield-without-assign
13+
tflog.SetField(ctx, "field", "value")
14+
}
15+
16+
func assigned() {
17+
ctx := context.Background()
18+
19+
// ok: setfield-without-assign
20+
ctx = tflog.SetField(ctx, "field", "value")
21+
}
22+
23+
func returnedContext() context.Context {
24+
ctx := context.Background()
25+
26+
// ok: setfield-without-assign
27+
return tflog.SetField(ctx, "field", "value")
28+
}
29+
30+
func declareAndAssign_SameName() {
31+
ctx := context.Background()
32+
33+
for i := 0; i < 1; i++ {
34+
// ok: setfield-without-assign
35+
ctx := tflog.SetField(ctx, "field", "value")
36+
}
37+
}
38+
39+
func declareAndAssign_Rename() {
40+
outerCtx := context.Background()
41+
42+
for i := 0; i < 1; i++ {
43+
// ok: setfield-without-assign
44+
innerCtx := tflog.SetField(outerCtx, "field", "value")
45+
}
46+
}

.ci/semgrep/tflog/tflog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ rules:
44
message: The return value of "tflog.SetField" must be used
55
patterns:
66
- pattern: tflog.SetField(...)
7-
- pattern-not-inside: $CTX = tflog.SetField($CTX, ...)
7+
- pattern-not-inside: $CTX1 = tflog.SetField($CTX2, ...)
88
- pattern-not-inside: return tflog.SetField($CTX, ...)
99
severity: ERROR

go.mod

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@ require (
310310
github.com/mitchellh/mapstructure v1.5.0
311311
github.com/pquerna/otp v1.5.0
312312
github.com/shopspring/decimal v1.4.0
313+
go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.63.0
314+
go.opentelemetry.io/otel v1.38.0
313315
golang.org/x/crypto v0.43.0
314316
golang.org/x/text v0.30.0
315317
golang.org/x/tools v0.38.0
@@ -370,8 +372,6 @@ require (
370372
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
371373
github.com/zclconf/go-cty v1.17.0 // indirect
372374
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
373-
go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.63.0 // indirect
374-
go.opentelemetry.io/otel v1.38.0 // indirect
375375
go.opentelemetry.io/otel/metric v1.38.0 // indirect
376376
go.opentelemetry.io/otel/trace v1.38.0 // indirect
377377
golang.org/x/exp v0.0.0-20220921023135-46d9e7742f1e // indirect
@@ -386,3 +386,5 @@ require (
386386
)
387387

388388
replace github.com/hashicorp/terraform-plugin-log => github.com/gdavison/terraform-plugin-log v0.0.0-20230928191232-6c653d8ef8fb
389+
390+
replace github.com/hashicorp/terraform-plugin-testing => github.com/gdavison/terraform-plugin-testing v0.0.0-20251008214752-cb22fd14f84d

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,8 @@ github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
596596
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
597597
github.com/gdavison/terraform-plugin-log v0.0.0-20230928191232-6c653d8ef8fb h1:HM67IMNxlkqGxAM5ymxMg2ANCcbL4oEr5cy+tGZ6fNo=
598598
github.com/gdavison/terraform-plugin-log v0.0.0-20230928191232-6c653d8ef8fb/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow=
599+
github.com/gdavison/terraform-plugin-testing v0.0.0-20251008214752-cb22fd14f84d h1:m3Al87LjSaNb/GWqj//HUPwYlkhxTpYO7Z5nlSF3dpY=
600+
github.com/gdavison/terraform-plugin-testing v0.0.0-20251008214752-cb22fd14f84d/go.mod h1:LEK/JDcSM5eupLL8D0j/CIarlOTrl2wSmQE20mX/xSU=
599601
github.com/gertd/go-pluralize v0.2.1 h1:M3uASbVjMnTsPb0PNqg+E/24Vwigyo/tvyMTtAlLgiA=
600602
github.com/gertd/go-pluralize v0.2.1/go.mod h1:rbYaKDbsXxmRfr8uygAEKhOWsjyrrqrkHVpZvoOp8zk=
601603
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
@@ -685,8 +687,6 @@ github.com/hashicorp/terraform-plugin-mux v0.21.0 h1:QsEYnzSD2c3zT8zUrUGqaFGhV/Z
685687
github.com/hashicorp/terraform-plugin-mux v0.21.0/go.mod h1:Qpt8+6AD7NmL0DS7ASkN0EXpDQ2J/FnnIgeUr1tzr5A=
686688
github.com/hashicorp/terraform-plugin-sdk/v2 v2.38.1 h1:mlAq/OrMlg04IuJT7NpefI1wwtdpWudnEmjuQs04t/4=
687689
github.com/hashicorp/terraform-plugin-sdk/v2 v2.38.1/go.mod h1:GQhpKVvvuwzD79e8/NZ+xzj+ZpWovdPAe8nfV/skwNU=
688-
github.com/hashicorp/terraform-plugin-testing v1.14.0-beta.1 h1:caWmY2Fv/KgDAXU7IVjcBDfIdmr/n6VRYhCLxNmlaXs=
689-
github.com/hashicorp/terraform-plugin-testing v1.14.0-beta.1/go.mod h1:jVm3pD9uQAT0X2RSEdcqjju2bCGv5f73DGZFU4v7EAU=
690690
github.com/hashicorp/terraform-registry-address v0.4.0 h1:S1yCGomj30Sao4l5BMPjTGZmCNzuv7/GDTDX99E9gTk=
691691
github.com/hashicorp/terraform-registry-address v0.4.0/go.mod h1:LRS1Ay0+mAiRkUyltGT+UHWkIqTFvigGn/LbMshfflE=
692692
github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ=

internal/acctest/knownvalue/account_id.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) HashiCorp, Inc.
22
// SPDX-License-Identifier: MPL-2.0
33

4-
package statecheck
4+
package knownvalue
55

66
import (
77
"context"
@@ -34,7 +34,7 @@ func (v accountID) CheckValue(other any) error {
3434

3535
// String returns the string representation of the value.
3636
func (v accountID) String() string {
37-
return "Who Knows"
37+
return "Account ID"
3838
}
3939

4040
func AccountID() knownvalue.Check {

internal/acctest/knownvalue/global_arn_exact.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) HashiCorp, Inc.
22
// SPDX-License-Identifier: MPL-2.0
33

4-
package statecheck
4+
package knownvalue
55

66
import (
77
"context"

internal/acctest/knownvalue/global_arn_regexp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) HashiCorp, Inc.
22
// SPDX-License-Identifier: MPL-2.0
33

4-
package statecheck
4+
package knownvalue
55

66
import (
77
"context"

internal/acctest/knownvalue/regional_arn_exact.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) HashiCorp, Inc.
22
// SPDX-License-Identifier: MPL-2.0
33

4-
package statecheck
4+
package knownvalue
55

66
import (
77
"context"

internal/acctest/knownvalue/regional_arn_regexp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) HashiCorp, Inc.
22
// SPDX-License-Identifier: MPL-2.0
33

4-
package statecheck
4+
package knownvalue
55

66
import (
77
"context"

internal/acctest/knownvalue/regional_arn_regexp_ignore_account.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) HashiCorp, Inc.
22
// SPDX-License-Identifier: MPL-2.0
33

4-
package statecheck
4+
package knownvalue
55

66
import (
77
"fmt"

0 commit comments

Comments
 (0)