Skip to content

Commit 4847fa4

Browse files
authored
Merge pull request #43960 from hashicorp/f-list-resource
List Resource initial Framework implementation
2 parents dc4be2c + e6b72a3 commit 4847fa4

File tree

52 files changed

+2062
-649
lines changed

Some content is hidden

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

52 files changed

+2062
-649
lines changed

.changelog/43960.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/aws_batch_job_queue: Adds List support
3+
```

.ci/tools/go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ require (
2828
cloud.google.com/go/monitoring v1.24.2 // indirect
2929
cloud.google.com/go/storage v1.53.0 // indirect
3030
codeberg.org/chavacava/garif v0.2.0 // indirect
31-
dario.cat/mergo v1.0.1 // indirect
31+
dario.cat/mergo v1.0.2 // indirect
3232
dev.gaijin.team/go/exhaustruct/v4 v4.0.0 // indirect
3333
dev.gaijin.team/go/golib v0.6.0 // indirect
3434
github.com/4meepo/tagalign v1.4.3 // indirect
@@ -44,7 +44,7 @@ require (
4444
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.51.0 // indirect
4545
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.51.0 // indirect
4646
github.com/Masterminds/goutils v1.1.1 // indirect
47-
github.com/Masterminds/semver/v3 v3.3.1 // indirect
47+
github.com/Masterminds/semver/v3 v3.4.0 // indirect
4848
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
4949
github.com/Microsoft/go-winio v0.6.2 // indirect
5050
github.com/OpenPeeDeeP/depguard/v2 v2.2.1 // indirect
@@ -313,7 +313,7 @@ require (
313313
github.com/sourcegraph/go-lsp v0.0.0-20200429204803-219e11d77f5d // indirect
314314
github.com/sourcegraph/jsonrpc2 v0.2.1 // indirect
315315
github.com/spf13/afero v1.14.0 // indirect
316-
github.com/spf13/cast v1.8.0 // indirect
316+
github.com/spf13/cast v1.10.0 // indirect
317317
github.com/spf13/cobra v1.9.1 // indirect
318318
github.com/spf13/pflag v1.0.7 // indirect
319319
github.com/spf13/viper v1.20.1 // indirect
@@ -351,7 +351,7 @@ require (
351351
github.com/ykadowak/zerologlint v0.1.5 // indirect
352352
github.com/yuin/goldmark v1.7.13 // indirect
353353
github.com/yuin/goldmark-meta v1.1.0 // indirect
354-
github.com/zclconf/go-cty v1.16.4 // indirect
354+
github.com/zclconf/go-cty v1.17.0 // indirect
355355
github.com/zclconf/go-cty-yaml v1.1.0 // indirect
356356
github.com/zeebo/errs v1.4.0 // indirect
357357
gitlab.com/bosi/decorder v0.4.2 // indirect

.ci/tools/go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,8 @@ cloud.google.com/go/workflows v1.9.0/go.mod h1:ZGkj1aFIOd9c8Gerkjjq7OW7I5+l6cSvT
622622
cloud.google.com/go/workflows v1.10.0/go.mod h1:fZ8LmRmZQWacon9UCX1r/g/DfAXx5VcPALq2CxzdePw=
623623
codeberg.org/chavacava/garif v0.2.0 h1:F0tVjhYbuOCnvNcU3YSpO6b3Waw6Bimy4K0mM8y6MfY=
624624
codeberg.org/chavacava/garif v0.2.0/go.mod h1:P2BPbVbT4QcvLZrORc2T29szK3xEOlnl0GiPTJmEqBQ=
625-
dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s=
626-
dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
625+
dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8=
626+
dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA=
627627
dev.gaijin.team/go/exhaustruct/v4 v4.0.0 h1:873r7aNneqoBB3IaFIzhvt2RFYTuHgmMjoKfwODoI1Y=
628628
dev.gaijin.team/go/exhaustruct/v4 v4.0.0/go.mod h1:aZ/k2o4Y05aMJtiux15x8iXaumE88YdiB0Ai4fXOzPI=
629629
dev.gaijin.team/go/golib v0.6.0 h1:v6nnznFTs4bppib/NyU1PQxobwDHwCXXl15P7DV5Zgo=
@@ -681,8 +681,8 @@ github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6
681681
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
682682
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
683683
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
684-
github.com/Masterminds/semver/v3 v3.3.1 h1:QtNSWtVZ3nBfk8mAOu/B6v7FMJ+NHTIgUPi7rj+4nv4=
685-
github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
684+
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
685+
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
686686
github.com/Masterminds/sprig/v3 v3.2.1/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk=
687687
github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs=
688688
github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0=
@@ -1826,8 +1826,8 @@ github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcD
18261826
github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA=
18271827
github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo=
18281828
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
1829-
github.com/spf13/cast v1.8.0 h1:gEN9K4b8Xws4EX0+a0reLmhq8moKn7ntRlQYgjPeCDk=
1830-
github.com/spf13/cast v1.8.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
1829+
github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
1830+
github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
18311831
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
18321832
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
18331833
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
@@ -1955,8 +1955,8 @@ github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBv
19551955
github.com/zalando/go-keyring v0.2.3 h1:v9CUu9phlABObO4LPWycf+zwMG7nlbb3t/B5wa97yms=
19561956
github.com/zalando/go-keyring v0.2.3/go.mod h1:HL4k+OXQfJUWaMnqyuSOc0drfGPX2b51Du6K+MRgZMk=
19571957
github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
1958-
github.com/zclconf/go-cty v1.16.4 h1:QGXaag7/7dCzb+odlGrgr+YmYZFaOCMW6DEpS+UD1eE=
1959-
github.com/zclconf/go-cty v1.16.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
1958+
github.com/zclconf/go-cty v1.17.0 h1:seZvECve6XX4tmnvRzWtJNHdscMtYEx5R7bnnVyd/d0=
1959+
github.com/zclconf/go-cty v1.17.0/go.mod h1:wqFzcImaLTI6A5HfsRwB0nj5n0MRZFwmey8YoFPPs3U=
19601960
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo=
19611961
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM=
19621962
github.com/zclconf/go-cty-yaml v1.1.0 h1:nP+jp0qPHv2IhUVqmQSzjvqAWcObN0KBkUl2rWBdig0=

GNUmakefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,6 @@ website-tflint: tflint-init ## [CI] Website Checks / tflint
897897
"--disable-rule=aws_s3_object_copy_invalid_source" \
898898
"--disable-rule=aws_servicecatalog_portfolio_share_invalid_type" \
899899
"--disable-rule=aws_transfer_ssh_key_invalid_body" \
900-
"--disable-rule=aws_worklink_website_certificate_authority_association_invalid_certificate" \
901900
"--disable-rule=terraform_unused_declarations" \
902901
"--disable-rule=terraform_typed_variables" \
903902
) ; \

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ require (
300300
github.com/hashicorp/terraform-plugin-log v0.9.0
301301
github.com/hashicorp/terraform-plugin-mux v0.21.0
302302
github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0
303-
github.com/hashicorp/terraform-plugin-testing v1.13.3-0.20250909115916-1a2eeae85247
303+
github.com/hashicorp/terraform-plugin-testing v1.13.3-0.20250917121907-cca15217581a
304304
github.com/jaswdr/faker/v2 v2.8.0
305305
github.com/jmespath/go-jmespath v0.4.0
306306
github.com/mattbaird/jsonpatch v0.0.0-20240118010651-0ba75a80ca38
@@ -349,7 +349,7 @@ require (
349349
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
350350
github.com/hashicorp/hc-install v0.9.2 // indirect
351351
github.com/hashicorp/logutils v1.0.0 // indirect
352-
github.com/hashicorp/terraform-exec v0.23.1-0.20250717072919-061a850a52d2 // indirect
352+
github.com/hashicorp/terraform-exec v0.24.0 // indirect
353353
github.com/hashicorp/terraform-registry-address v0.4.0 // indirect
354354
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
355355
github.com/hashicorp/yamux v0.1.2 // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -665,8 +665,8 @@ github.com/hashicorp/hcl/v2 v2.24.0 h1:2QJdZ454DSsYGoaE6QheQZjtKZSUs9Nh2izTWiwQx
665665
github.com/hashicorp/hcl/v2 v2.24.0/go.mod h1:oGoO1FIQYfn/AgyOhlg9qLC6/nOJPX3qGbkZpYAcqfM=
666666
github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y=
667667
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
668-
github.com/hashicorp/terraform-exec v0.23.1-0.20250717072919-061a850a52d2 h1:90fcAqw0Qmv4vY7zL4jEKgKarHmOnNN6SjTY68eLKGA=
669-
github.com/hashicorp/terraform-exec v0.23.1-0.20250717072919-061a850a52d2/go.mod h1:8D3RLLpzAZdhT9jvALYz1KHyGU4OvI73I1o0+01QJxA=
668+
github.com/hashicorp/terraform-exec v0.24.0 h1:mL0xlk9H5g2bn0pPF6JQZk5YlByqSqrO5VoaNtAf8OE=
669+
github.com/hashicorp/terraform-exec v0.24.0/go.mod h1:lluc/rDYfAhYdslLJQg3J0oDqo88oGQAdHR+wDqFvo4=
670670
github.com/hashicorp/terraform-json v0.27.2 h1:BwGuzM6iUPqf9JYM/Z4AF1OJ5VVJEEzoKST/tRDBJKU=
671671
github.com/hashicorp/terraform-json v0.27.2/go.mod h1:GzPLJ1PLdUG5xL6xn1OXWIjteQRT2CNT9o/6A9mi9hE=
672672
github.com/hashicorp/terraform-plugin-framework v1.16.0 h1:tP0f+yJg0Z672e7levixDe5EpWwrTrNryPM9kDMYIpE=
@@ -685,8 +685,8 @@ github.com/hashicorp/terraform-plugin-mux v0.21.0 h1:QsEYnzSD2c3zT8zUrUGqaFGhV/Z
685685
github.com/hashicorp/terraform-plugin-mux v0.21.0/go.mod h1:Qpt8+6AD7NmL0DS7ASkN0EXpDQ2J/FnnIgeUr1tzr5A=
686686
github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0 h1:NFPMacTrY/IdcIcnUB+7hsore1ZaRWU9cnB6jFoBnIM=
687687
github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0/go.mod h1:QYmYnLfsosrxjCnGY1p9c7Zj6n9thnEE+7RObeYs3fA=
688-
github.com/hashicorp/terraform-plugin-testing v1.13.3-0.20250909115916-1a2eeae85247 h1:lA6ofPwmCXAX7J7kVP9t/WMU5+eA4e9YvJUiRLPdENw=
689-
github.com/hashicorp/terraform-plugin-testing v1.13.3-0.20250909115916-1a2eeae85247/go.mod h1:4r/7cxl1mpskfALcq58Iyu5aPiTSco8SVrKkcLyP5g4=
688+
github.com/hashicorp/terraform-plugin-testing v1.13.3-0.20250917121907-cca15217581a h1:ZR7fP9+RhyyPG3Pt0cyJLGv+RhwgM2Djw6bpR6lZTSY=
689+
github.com/hashicorp/terraform-plugin-testing v1.13.3-0.20250917121907-cca15217581a/go.mod h1:EutH7GqQVuQ93JFgTfWFiytgzpGzsqx3aUMcssK5V8s=
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/conns/conns.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package conns
55

66
import (
77
"context"
8+
"iter"
89

910
"github.com/hashicorp/terraform-provider-aws/internal/types"
1011
"github.com/hashicorp/terraform-provider-aws/internal/vcr"
@@ -34,6 +35,11 @@ type ServicePackageWithEphemeralResources interface {
3435
EphemeralResources(context.Context) []*types.ServicePackageEphemeralResource
3536
}
3637

38+
type ServicePackageWithFrameworkListResources interface {
39+
ServicePackage
40+
FrameworkListResources(context.Context) iter.Seq[*types.ServicePackageFrameworkListResource]
41+
}
42+
3743
type (
3844
contextKeyType int
3945
)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
4+
package framework
5+
6+
import (
7+
inttypes "github.com/hashicorp/terraform-provider-aws/internal/types"
8+
)
9+
10+
type Identityer interface {
11+
SetIdentitySpec(identity inttypes.Identity)
12+
}
13+
14+
var _ Identityer = &WithIdentity{}
15+
16+
type WithIdentity struct {
17+
identity inttypes.Identity
18+
}
19+
20+
func (w *WithIdentity) SetIdentitySpec(identity inttypes.Identity) {
21+
w.identity = identity
22+
}
23+
24+
func (w WithIdentity) IdentitySpec() inttypes.Identity {
25+
return w.identity
26+
}

internal/framework/with_import_by_identity.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import (
1313

1414
// TODO: Needs a better name
1515
type ImportByIdentityer interface {
16-
SetIdentitySpec(identity inttypes.Identity, importSpec inttypes.FrameworkImport)
16+
Identityer
17+
SetImportSpec(importSpec inttypes.FrameworkImport)
1718
}
1819

1920
var _ ImportByIdentityer = &WithImportByIdentity{}
@@ -22,12 +23,11 @@ var _ ImportByIdentityer = &WithImportByIdentity{}
2223
//
2324
// See: https://developer.hashicorp.com/terraform/plugin/framework/resources/identity#importing-by-identity
2425
type WithImportByIdentity struct {
25-
identity inttypes.Identity
26+
WithIdentity
2627
importSpec inttypes.FrameworkImport
2728
}
2829

29-
func (w *WithImportByIdentity) SetIdentitySpec(identity inttypes.Identity, importSpec inttypes.FrameworkImport) {
30-
w.identity = identity
30+
func (w *WithImportByIdentity) SetImportSpec(importSpec inttypes.FrameworkImport) {
3131
w.importSpec = importSpec
3232
}
3333

@@ -55,10 +55,6 @@ func (w WithImportByIdentity) ImportState(ctx context.Context, request resource.
5555
}
5656
}
5757

58-
func (w WithImportByIdentity) IdentitySpec() inttypes.Identity {
59-
return w.identity
60-
}
61-
6258
func (w WithImportByIdentity) ImportSpec() inttypes.FrameworkImport {
6359
return w.importSpec
6460
}

internal/framework/with_list.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
4+
package framework
5+
6+
import (
7+
"github.com/hashicorp/terraform-provider-aws/internal/provider/framework/listresource"
8+
)
9+
10+
type Lister interface {
11+
AppendResultInterceptor(listresource.ListResultInterceptor)
12+
}
13+
14+
var _ Lister = &WithList{}
15+
16+
type WithList struct {
17+
interceptors []listresource.ListResultInterceptor
18+
}
19+
20+
func (w *WithList) AppendResultInterceptor(interceptor listresource.ListResultInterceptor) {
21+
w.interceptors = append(w.interceptors, interceptor)
22+
}
23+
24+
func (w WithList) ResultInterceptors() []listresource.ListResultInterceptor {
25+
return w.interceptors
26+
}

0 commit comments

Comments
 (0)