Skip to content

Commit c1efdd2

Browse files
authored
Merge pull request hashicorp#32291 from hashicorp/td-sweepers
sweepers: Adds new registration and removes boilerplate
2 parents 0c75ead + 44bed82 commit c1efdd2

File tree

166 files changed

+1395
-1642
lines changed

Some content is hidden

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

166 files changed

+1395
-1642
lines changed

.github/workflows/provider.yml

+35-4
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,11 @@ jobs:
170170
- run: cd .ci/tools && go install github.com/pavius/impi/cmd/impi
171171
- run: impi --local . --scheme stdThirdPartyLocal ./...
172172

173-
compile_sweepers:
174-
name: Compile sweepers
173+
# validate_sweepers_unlinked checks that the sweeper functions are not linked in the provider binary.
174+
# As a pre-check, to validate that the check will work, it confirms that `strings` will find the function
175+
# names in the compiled sweeper binary.
176+
validate_sweepers_unlinked:
177+
name: Sweeper Functions Not Linked
175178
needs: [go_build]
176179
runs-on: [custom, linux, medium]
177180
steps:
@@ -197,8 +200,36 @@ jobs:
197200
with:
198201
path: ~/go/pkg/mod
199202
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
200-
- name: Try building
201-
run: go build -tags=sweep
203+
204+
- name: Pre-Check sweeper binary
205+
run: |
206+
go test -c -o ./sweeper-bin ./internal/sweep/
207+
count=$(strings ./sweeper-bin | \
208+
grep --count --extended-regexp 'internal/service/[a-zA-Z0-9]+\.sweep[a-zA-Z0-9]+$')
209+
[ $count -gt 0 ] || \
210+
(echo; echo "Expected `strings` to detect sweeper function names in sweeper binary."; exit 1)
211+
212+
# Use cached provider or rebuild
213+
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
214+
continue-on-error: true
215+
id: cache-terraform-plugin-dir
216+
timeout-minutes: 2
217+
with:
218+
path: terraform-plugin-dir
219+
key: ${{ runner.os }}-terraform-plugin-dir-${{ hashFiles('go.sum') }}-${{ hashFiles('internal/**') }}
220+
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
221+
name: go build
222+
run: go build -o terraform-plugin-dir/registry.terraform.io/hashicorp/aws/99.99.99/$(go env GOOS)_$(go env GOARCH)/terraform-provider-aws .
223+
224+
- name: Check provider binary
225+
run: |
226+
# grep returns the exit code 1 if there are no results. Disable immediate exit.
227+
set +e
228+
count=$(strings "terraform-plugin-dir/registry.terraform.io/hashicorp/aws/99.99.99/$(go env GOOS)_$(go env GOARCH)/terraform-provider-aws" | \
229+
grep --count --extended-regexp 'internal/service/[a-zA-Z0-9]+\.sweep[a-zA-Z0-9]+$')
230+
set -e
231+
[ $count -eq 0 ] || \
232+
(echo; echo "Expected `strings` to detect no sweeper function names in provider binary."; exit 1)
202233
203234
terraform_providers_schema:
204235
name: terraform providers schema

.teamcity/scripts/sweeper.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ EOF
3030
export AWS_PROFILE=sweeper
3131
fi
3232

33-
go test ./internal/sweep -v -tags=sweep -sweep="%SWEEPER_REGIONS%" -sweep-allow-failures -timeout=4h
33+
go test ./internal/sweep -v -sweep="%SWEEPER_REGIONS%" -sweep-allow-failures -timeout=4h

GNUmakefile

+2-4
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ gen: ## Run all Go generators
148148
rm -f internal/conns/*_gen.go
149149
rm -f internal/provider/*_gen.go
150150
rm -f internal/service/**/*_gen.go
151-
rm -f internal/sweep/sweep_test.go internal/sweep/service_packages_gen_test.go
152151
rm -f names/caps.md
153152
rm -f names/*_gen.go
154153
rm -f website/docs/guides/custom-service-endpoints.html.md
@@ -159,7 +158,6 @@ gen: ## Run all Go generators
159158
# Generate service package lists last as they may depend on output of earlier generators.
160159
rm -f internal/provider/service_packages_gen.go
161160
$(GO_VER) generate ./internal/provider
162-
rm -f internal/sweep/sweep_test.go internal/sweep/service_packages_gen_test.go
163161
$(GO_VER) generate ./internal/sweep
164162

165163
gencheck: ## Verify generated code is tidy
@@ -323,11 +321,11 @@ sweep: ## Run sweepers
323321
# make sweep SWEEPARGS=-sweep-run=aws_example_thing
324322
# set SWEEPARGS=-sweep-allow-failures to continue after first failure
325323
@echo "WARNING: This will destroy infrastructure. Use only in development accounts."
326-
$(GO_VER) test $(SWEEP_DIR) -v -tags=sweep -sweep=$(SWEEP) $(SWEEPARGS) -timeout $(SWEEP_TIMEOUT)
324+
$(GO_VER) test $(SWEEP_DIR) -v -sweep=$(SWEEP) $(SWEEPARGS) -timeout $(SWEEP_TIMEOUT)
327325

328326
sweeper: ## Run sweepers with failures allowed
329327
@echo "WARNING: This will destroy infrastructure. Use only in development accounts."
330-
$(GO_VER) test $(SWEEP_DIR) -v -tags=sweep -sweep=$(SWEEP) SWEEPARGS=-sweep-allow-failures -timeout $(SWEEP_TIMEOUT)
328+
$(GO_VER) test $(SWEEP_DIR) -v -tags=sweep -sweep=$(SWEEP) -sweep-allow-failures -timeout $(SWEEP_TIMEOUT)
331329

332330
t: fmtcheck
333331
TF_ACC=1 $(GO_VER) test ./$(PKG_NAME)/... -v -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) $(RUNARGS) $(TESTARGS) -timeout $(ACCTEST_TIMEOUT)

docs/running-and-writing-acceptance-tests.md

+4-7
Original file line numberDiff line numberDiff line change
@@ -1097,16 +1097,13 @@ To run sweepers with an assumed role, use the following additional environment v
10971097
Sweeper logic should be written to a file called `sweep.go` in the appropriate service subdirectory (`internal/service/{serviceName}`). This file should include the following build tags above the package declaration:
10981098

10991099
```go
1100-
//go:build sweep
1101-
// +build sweep
1102-
11031100
package example
11041101
```
11051102

1106-
Next, initialize the resource into the test sweeper framework:
1103+
Next, register the resource into the test sweeper framework:
11071104

11081105
```go
1109-
func init() {
1106+
func RegisterSweepers() {
11101107
resource.AddTestSweepers("aws_example_thing", &resource.Sweeper{
11111108
Name: "aws_example_thing",
11121109
F: sweepThings,
@@ -1167,7 +1164,7 @@ func sweepThings(region string) error {
11671164
return !lastPage
11681165
})
11691166

1170-
if sweep.SkipSweepError(err) {
1167+
if awsv1.SkipSweepError(err) {
11711168
log.Printf("[WARN] Skipping Example Thing sweep for %s: %s", region, errs)
11721169
return nil
11731170
}
@@ -1204,7 +1201,7 @@ func sweepThings(region string) error {
12041201

12051202
for {
12061203
output, err := conn.ListThings(input)
1207-
if sweep.SkipSweepError(err) {
1204+
if awsv1.SkipSweepError(err) {
12081205
log.Printf("[WARN] Skipping Example Thing sweep for %s: %s", region, errs)
12091206
return nil
12101207
}

go.mod

+10-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/hashicorp/terraform-provider-aws
33
go 1.20
44

55
require (
6-
github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95
6+
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c
77
github.com/YakDriver/regexache v0.23.0
88
github.com/aws/aws-sdk-go v1.45.25
99
github.com/aws/aws-sdk-go-v2 v1.21.2
@@ -81,7 +81,8 @@ require (
8181
github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2 v2.0.0-beta.38
8282
github.com/hashicorp/awspolicyequivalence v1.6.0
8383
github.com/hashicorp/go-cleanhttp v0.5.2
84-
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
84+
github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637
85+
github.com/hashicorp/go-hclog v1.5.0
8586
github.com/hashicorp/go-multierror v1.1.1
8687
github.com/hashicorp/go-uuid v1.0.3
8788
github.com/hashicorp/go-version v1.6.0
@@ -150,8 +151,7 @@ require (
150151
github.com/google/uuid v1.3.1 // indirect
151152
github.com/hashicorp/errwrap v1.1.0 // indirect
152153
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
153-
github.com/hashicorp/go-hclog v1.5.0 // indirect
154-
github.com/hashicorp/go-plugin v1.5.1 // indirect
154+
github.com/hashicorp/go-plugin v1.5.2 // indirect
155155
github.com/hashicorp/hc-install v0.6.0 // indirect
156156
github.com/hashicorp/logutils v1.0.0 // indirect
157157
github.com/hashicorp/terraform-exec v0.19.0 // indirect
@@ -160,7 +160,7 @@ require (
160160
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
161161
github.com/hashicorp/yamux v0.1.1 // indirect
162162
github.com/huandu/xstrings v1.4.0 // indirect
163-
github.com/imdario/mergo v0.3.15 // indirect
163+
github.com/imdario/mergo v0.3.16 // indirect
164164
github.com/mattn/go-colorable v0.1.13 // indirect
165165
github.com/mattn/go-isatty v0.0.19 // indirect
166166
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
@@ -185,10 +185,12 @@ require (
185185
golang.org/x/net v0.17.0 // indirect
186186
golang.org/x/sys v0.13.0 // indirect
187187
golang.org/x/text v0.13.0 // indirect
188-
google.golang.org/appengine v1.6.7 // indirect
189-
google.golang.org/genproto/googleapis/rpc v0.0.0-20230807174057-1744710a1577 // indirect
190-
google.golang.org/grpc v1.57.0 // indirect
188+
google.golang.org/appengine v1.6.8 // indirect
189+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect
190+
google.golang.org/grpc v1.58.2 // indirect
191191
google.golang.org/protobuf v1.31.0 // indirect
192192
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
193193
gopkg.in/yaml.v3 v3.0.1 // indirect
194194
)
195+
196+
replace github.com/hashicorp/terraform-plugin-log => github.com/gdavison/terraform-plugin-log v0.0.0-20230928191232-6c653d8ef8fb

go.sum

+18-18
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ github.com/Masterminds/sprig/v3 v3.2.1/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFP
99
github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA=
1010
github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM=
1111
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
12-
github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 h1:KLq8BE0KwCL+mmXnjLWEAOYO+2l2AE4YMmqG1ZpZHBs=
13-
github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
12+
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c h1:kMFnB0vCcX7IL/m9Y5LO+KQYv+t1CQOiFe6+SV2J7bE=
13+
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
1414
github.com/YakDriver/regexache v0.23.0 h1:kv3j4XKhbx/vqUilSBgizXDUXHvvH1KdYekdmGwz4C4=
1515
github.com/YakDriver/regexache v0.23.0/go.mod h1:K4BZ3MYKAqSFbYWqmbsG+OzYUDyJjnMEr27DJEsVG3U=
1616
github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ=
@@ -225,6 +225,8 @@ github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
225225
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
226226
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
227227
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
228+
github.com/gdavison/terraform-plugin-log v0.0.0-20230928191232-6c653d8ef8fb h1:HM67IMNxlkqGxAM5ymxMg2ANCcbL4oEr5cy+tGZ6fNo=
229+
github.com/gdavison/terraform-plugin-log v0.0.0-20230928191232-6c653d8ef8fb/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow=
228230
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
229231
github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4=
230232
github.com/go-git/go-git/v5 v5.8.1 h1:Zo79E4p7TRk0xoRgMq0RShiTHGKcKI4+DI6BfJc/Q+A=
@@ -237,8 +239,8 @@ github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg=
237239
github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
238240
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
239241
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
240-
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
241242
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
243+
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
242244
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
243245
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
244246
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
@@ -267,15 +269,15 @@ github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuD
267269
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
268270
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
269271
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
270-
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI=
271-
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs=
272+
github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637 h1:Ud/6/AdmJ1R7ibdS0Wo5MWPj0T1R0fkpaD087bBaW8I=
273+
github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs=
272274
github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c=
273275
github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
274276
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
275277
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
276278
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
277-
github.com/hashicorp/go-plugin v1.5.1 h1:oGm7cWBaYIp3lJpx1RUEfLWophprE2EV/KUeqBYo+6k=
278-
github.com/hashicorp/go-plugin v1.5.1/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4=
279+
github.com/hashicorp/go-plugin v1.5.2 h1:aWv8eimFqWlsEiMrYZdPYl+FdHaBJSN4AWwGWfT1G2Y=
280+
github.com/hashicorp/go-plugin v1.5.2/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4=
279281
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
280282
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
281283
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
@@ -299,8 +301,6 @@ github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 h1:HOjBuMbOEz
299301
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0/go.mod h1:jfHGE/gzjxYz6XoUwi/aYiiKrJDeutQNUtGQXkaHklg=
300302
github.com/hashicorp/terraform-plugin-go v0.19.0 h1:BuZx/6Cp+lkmiG0cOBk6Zps0Cb2tmqQpDM3iAtnhDQU=
301303
github.com/hashicorp/terraform-plugin-go v0.19.0/go.mod h1:EhRSkEPNoylLQntYsk5KrDHTZJh9HQoumZXbOGOXmec=
302-
github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0=
303-
github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow=
304304
github.com/hashicorp/terraform-plugin-mux v0.12.0 h1:TJlmeslQ11WlQtIFAfth0vXx+gSNgvMEng2Rn9z3WZY=
305305
github.com/hashicorp/terraform-plugin-mux v0.12.0/go.mod h1:8MR0AgmV+Q03DIjyrAKxXyYlq2EUnYBQP8gxAAA0zeM=
306306
github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0 h1:wcOKYwPI9IorAJEBLzgclh3xVolO7ZorYd6U1vnok14=
@@ -319,8 +319,8 @@ github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq
319319
github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU=
320320
github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
321321
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
322-
github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM=
323-
github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
322+
github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
323+
github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
324324
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
325325
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
326326
github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c=
@@ -442,7 +442,6 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
442442
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
443443
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
444444
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
445-
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
446445
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
447446
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
448447
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
@@ -487,6 +486,7 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
487486
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
488487
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
489488
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
489+
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
490490
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
491491
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
492492
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
@@ -501,12 +501,12 @@ golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg
501501
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
502502
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
503503
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
504-
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
505-
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
506-
google.golang.org/genproto/googleapis/rpc v0.0.0-20230807174057-1744710a1577 h1:wukfNtZmZUurLN/atp2hiIeTKn7QJWIQdHzqmsOnAOk=
507-
google.golang.org/genproto/googleapis/rpc v0.0.0-20230807174057-1744710a1577/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M=
508-
google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw=
509-
google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
504+
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
505+
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
506+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 h1:N3bU/SQDCDyD6R528GJ/PwW9KjYcJA3dgyH+MovAkIM=
507+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA=
508+
google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I=
509+
google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0=
510510
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
511511
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
512512
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Code generated by internal/generate/sweeperregistration/main.go; DO NOT EDIT.
2+
3+
package {{ .PackageName }}
4+
5+
import (
6+
{{ range .Services }}
7+
"github.com/hashicorp/terraform-provider-aws/internal/service/{{ .ProviderPackage }}"
8+
{{- end }}
9+
)
10+
11+
func registerSweepers() {
12+
{{- range .Services }}
13+
{{ .ProviderPackage }}.RegisterSweepers()
14+
{{- end }}
15+
}

internal/generate/sweepimp/main.go renamed to internal/generate/sweeperregistration/main.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type TemplateData struct {
2929

3030
func main() {
3131
const (
32-
filename = `sweep_test.go`
32+
filename = `register_gen_test.go`
3333
namesDataFile = "../../names/names_data.csv"
3434
)
3535
g := common.NewGenerator()
@@ -72,6 +72,7 @@ func main() {
7272
}
7373

7474
if _, err := os.Stat(fmt.Sprintf("../service/%s/sweep.go", p)); err != nil || errors.Is(err, fs.ErrNotExist) {
75+
g.Infof("No sweepers for %q", p)
7576
continue
7677
}
7778

@@ -88,7 +89,7 @@ func main() {
8889

8990
d := g.NewGoFileDestination(filename)
9091

91-
if err := d.WriteTemplate("sweepimport", tmpl, td); err != nil {
92+
if err := d.WriteTemplate("sweeperregistration", tmpl, td); err != nil {
9293
g.Fatalf("generating file (%s): %s", filename, err)
9394
}
9495

internal/generate/sweepimp/file.tmpl

-19
This file was deleted.

0 commit comments

Comments
 (0)