Commit 2c53338
committed
internal/provider: refactor required tag early returns
Previously the check for whether tag policy compliance was enabled and included required tags for the current resource type was nested in the middle of the required tag validation logic. It is now moved to the start to exit as early as possible and prevent unnecessary processing of tag values.
```console
% TF_ACC_REQUIRED_TAG_KEY=Owner make t K=iot T=TestAccIoTBillingGroup_requiredTags
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
make: Running acceptance tests on branch: 🌿 b-tag-policy-interceptor 🌿...
TF_ACC=1 go1.24.10 test ./internal/service/iot/... -v -count 1 -parallel 20 -run='TestAccIoTBillingGroup_requiredTags' -timeout 360m -vet=off
2025/11/21 10:54:23 Creating Terraform AWS Provider (SDKv2-style)...
2025/11/21 10:54:23 Initializing Terraform AWS Provider (SDKv2-style)...
--- PASS: TestAccIoTBillingGroup_requiredTags_defaultTags (21.24s)
--- PASS: TestAccIoTBillingGroup_requiredTags (21.25s)
--- PASS: TestAccIoTBillingGroup_requiredTags_disabled (35.96s)
--- PASS: TestAccIoTBillingGroup_requiredTags_warning (39.28s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/iot 45.913s
```
```console
% TF_ACC_REQUIRED_TAG_KEY=Owner make t K=logs T=TestAccLogsLogGroup_requiredTags
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
make: Running acceptance tests on branch: 🌿 b-tag-policy-interceptor 🌿...
TF_ACC=1 go1.24.10 test ./internal/service/logs/... -v -count 1 -parallel 20 -run='TestAccLogsLogGroup_requiredTags' -timeout 360m -vet=off
2025/11/21 10:57:30 Creating Terraform AWS Provider (SDKv2-style)...
2025/11/21 10:57:30 Initializing Terraform AWS Provider (SDKv2-style)...
--- PASS: TestAccLogsLogGroup_requiredTags (19.66s)
--- PASS: TestAccLogsLogGroup_requiredTags_defaultTags (19.75s)
--- PASS: TestAccLogsLogGroup_requiredTags_disabled (35.51s)
--- PASS: TestAccLogsLogGroup_requiredTags_warning (38.56s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/logs 45.089s
```1 parent d866110 commit 2c53338
File tree
3 files changed
+21
-20
lines changed- .changelog
- internal/provider
- framework
- sdkv2
3 files changed
+21
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
281 | 290 | | |
282 | 291 | | |
283 | 292 | | |
| |||
302 | 311 | | |
303 | 312 | | |
304 | 313 | | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | 314 | | |
316 | 315 | | |
317 | 316 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
312 | 321 | | |
313 | 322 | | |
314 | 323 | | |
| |||
320 | 329 | | |
321 | 330 | | |
322 | 331 | | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | 332 | | |
334 | 333 | | |
335 | 334 | | |
| |||
0 commit comments