Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tech debt: Reduce tags boilerplate code - Generate and use createTags #30874

Merged
merged 36 commits into from
Apr 21, 2023

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Apr 21, 2023

Description

Generate (and use) a createTags function for use by resource whose Create API call does not accept tags so tagging is done as a separate action.

This PR does not include resources where we have conditional logic for the non-Commercial partitions around this functionality.

Relations

Relates #29747.

Output from Acceptance Testing

% make testacc TESTARGS='-run=TestAccSSMParameter_Overwrite_tags\|TestAccSSMParameter_tags' PKG=ssm
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ssm/... -v -count 1 -parallel 20  -run=TestAccSSMParameter_Overwrite_tags\|TestAccSSMParameter_tags -timeout 180m
=== RUN   TestAccSSMParameter_Overwrite_tags
=== PAUSE TestAccSSMParameter_Overwrite_tags
=== RUN   TestAccSSMParameter_tags
=== PAUSE TestAccSSMParameter_tags
=== CONT  TestAccSSMParameter_Overwrite_tags
=== CONT  TestAccSSMParameter_tags
--- PASS: TestAccSSMParameter_Overwrite_tags (17.60s)
--- PASS: TestAccSSMParameter_tags (39.32s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ssm	44.682s
% make testacc TESTARGS='-run=TestAccGlacierVault_tags' PKG=glacier
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/glacier/... -v -count 1 -parallel 20  -run=TestAccGlacierVault_tags -timeout 180m
=== RUN   TestAccGlacierVault_tags
=== PAUSE TestAccGlacierVault_tags
=== CONT  TestAccGlacierVault_tags
--- PASS: TestAccGlacierVault_tags (39.43s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/glacier	44.678s
% make testacc TESTARGS='-run=TestAccKinesisStream_tags\|TestAccKinesisStream_basic' PKG=kinesis
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/kinesis/... -v -count 1 -parallel 20  -run=TestAccKinesisStream_tags\|TestAccKinesisStream_basic -timeout 180m
=== RUN   TestAccKinesisStream_basic
=== PAUSE TestAccKinesisStream_basic
=== RUN   TestAccKinesisStream_tags
=== PAUSE TestAccKinesisStream_tags
=== RUN   TestAccKinesisStream_basicOnDemand
=== PAUSE TestAccKinesisStream_basicOnDemand
=== CONT  TestAccKinesisStream_basic
=== CONT  TestAccKinesisStream_basicOnDemand
=== CONT  TestAccKinesisStream_tags
--- PASS: TestAccKinesisStream_basic (49.74s)
--- PASS: TestAccKinesisStream_basicOnDemand (49.92s)
--- PASS: TestAccKinesisStream_tags (72.01s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/kinesis	77.265s
% make testacc TESTARGS='-run=TestAccVPCNetworkInterface_tags\|TestAccVPCNetworkInterface_ENI_ipv4Prefix\|TestAccVPCNetworkInterface_ENI_ipv6Prefix' PKG=ec2 ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 3  -run=TestAccVPCNetworkInterface_tags\|TestAccVPCNetworkInterface_ENI_ipv4Prefix\|TestAccVPCNetworkInterface_ENI_ipv6Prefix -timeout 180m
=== RUN   TestAccVPCNetworkInterface_tags
=== PAUSE TestAccVPCNetworkInterface_tags
=== RUN   TestAccVPCNetworkInterface_ENI_ipv4Prefix
=== PAUSE TestAccVPCNetworkInterface_ENI_ipv4Prefix
=== RUN   TestAccVPCNetworkInterface_ENI_ipv4PrefixCount
=== PAUSE TestAccVPCNetworkInterface_ENI_ipv4PrefixCount
=== RUN   TestAccVPCNetworkInterface_ENI_ipv6Prefix
=== PAUSE TestAccVPCNetworkInterface_ENI_ipv6Prefix
=== RUN   TestAccVPCNetworkInterface_ENI_ipv6PrefixCount
=== PAUSE TestAccVPCNetworkInterface_ENI_ipv6PrefixCount
=== CONT  TestAccVPCNetworkInterface_tags
=== CONT  TestAccVPCNetworkInterface_ENI_ipv6Prefix
=== CONT  TestAccVPCNetworkInterface_ENI_ipv4PrefixCount
--- PASS: TestAccVPCNetworkInterface_tags (70.80s)
=== CONT  TestAccVPCNetworkInterface_ENI_ipv4Prefix
--- PASS: TestAccVPCNetworkInterface_ENI_ipv6Prefix (79.47s)
=== CONT  TestAccVPCNetworkInterface_ENI_ipv6PrefixCount
--- PASS: TestAccVPCNetworkInterface_ENI_ipv4PrefixCount (88.20s)
--- PASS: TestAccVPCNetworkInterface_ENI_ipv4Prefix (67.16s)
--- PASS: TestAccVPCNetworkInterface_ENI_ipv6PrefixCount (91.62s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	177.727s
% make testacc TESTARGS='-run=TestAccLogsDestination_basic\|TestAccLogsDestination_tags' PKG=logs ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/logs/... -v -count 1 -parallel 3  -run=TestAccLogsDestination_basic\|TestAccLogsDestination_tags -timeout 180m
=== RUN   TestAccLogsDestination_basic
=== PAUSE TestAccLogsDestination_basic
=== RUN   TestAccLogsDestination_tags
=== PAUSE TestAccLogsDestination_tags
=== CONT  TestAccLogsDestination_basic
=== CONT  TestAccLogsDestination_tags
--- PASS: TestAccLogsDestination_basic (60.54s)
--- PASS: TestAccLogsDestination_tags (85.03s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/logs	90.504s
% make testacc TESTARGS='-run=TestAccOpsWorksStack_basic\|TestAccOpsWorksStack_tags' PKG=opsworks ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/opsworks/... -v -count 1 -parallel 3  -run=TestAccOpsWorksStack_basic\|TestAccOpsWorksStack_tags -timeout 180m
=== RUN   TestAccOpsWorksStack_basic
=== PAUSE TestAccOpsWorksStack_basic
=== RUN   TestAccOpsWorksStack_tags
=== PAUSE TestAccOpsWorksStack_tags
=== RUN   TestAccOpsWorksStack_tagsAlternateRegion
=== PAUSE TestAccOpsWorksStack_tagsAlternateRegion
=== CONT  TestAccOpsWorksStack_basic
=== CONT  TestAccOpsWorksStack_tagsAlternateRegion
=== CONT  TestAccOpsWorksStack_tags
=== CONT  TestAccOpsWorksStack_tagsAlternateRegion
    acctest.go:834: skipping tests; AWS_DEFAULT_REGION (us-west-2) not supported. Supported: [us-east-1]
--- SKIP: TestAccOpsWorksStack_tagsAlternateRegion (0.98s)
--- PASS: TestAccOpsWorksStack_basic (37.45s)
--- PASS: TestAccOpsWorksStack_tags (89.34s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/opsworks	94.729s
% make testacc TESTARGS='-run=TestAccRoute53Zone_basic\|TestAccRoute53Zone_tags\|TestAccRoute53HealthCheck_basic\|TestAccRoute53HealthCheck_tags' PKG=route53 ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/route53/... -v -count 1 -parallel 2  -run=TestAccRoute53Zone_basic\|TestAccRoute53Zone_tags\|TestAccRoute53HealthCheck_basic\|TestAccRoute53HealthCheck_tags -timeout 180m
=== RUN   TestAccRoute53HealthCheck_basic
=== PAUSE TestAccRoute53HealthCheck_basic
=== RUN   TestAccRoute53HealthCheck_tags
=== PAUSE TestAccRoute53HealthCheck_tags
=== RUN   TestAccRoute53Zone_basic
=== PAUSE TestAccRoute53Zone_basic
=== RUN   TestAccRoute53Zone_tags
=== PAUSE TestAccRoute53Zone_tags
=== CONT  TestAccRoute53HealthCheck_basic
=== CONT  TestAccRoute53Zone_basic
--- PASS: TestAccRoute53HealthCheck_basic (55.77s)
=== CONT  TestAccRoute53HealthCheck_tags
--- PASS: TestAccRoute53Zone_basic (81.71s)
=== CONT  TestAccRoute53Zone_tags
--- PASS: TestAccRoute53HealthCheck_tags (74.91s)
--- PASS: TestAccRoute53Zone_tags (121.10s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/route53	220.297s
% make testacc TESTARGS='-run=_basic$$\|_tags$$' PKG=route53recoveryreadiness ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/route53recoveryreadiness/... -v -count 1 -parallel 2  -run=_basic$\|_tags$ -timeout 180m
=== RUN   TestAccRoute53RecoveryReadinessCell_basic
=== PAUSE TestAccRoute53RecoveryReadinessCell_basic
=== RUN   TestAccRoute53RecoveryReadinessCell_tags
=== PAUSE TestAccRoute53RecoveryReadinessCell_tags
=== RUN   TestAccRoute53RecoveryReadinessReadinessCheck_basic
=== PAUSE TestAccRoute53RecoveryReadinessReadinessCheck_basic
=== RUN   TestAccRoute53RecoveryReadinessReadinessCheck_tags
=== PAUSE TestAccRoute53RecoveryReadinessReadinessCheck_tags
=== RUN   TestAccRoute53RecoveryReadinessRecoveryGroup_basic
=== PAUSE TestAccRoute53RecoveryReadinessRecoveryGroup_basic
=== RUN   TestAccRoute53RecoveryReadinessRecoveryGroup_tags
=== PAUSE TestAccRoute53RecoveryReadinessRecoveryGroup_tags
=== RUN   TestAccRoute53RecoveryReadinessResourceSet_basic
=== PAUSE TestAccRoute53RecoveryReadinessResourceSet_basic
=== RUN   TestAccRoute53RecoveryReadinessResourceSet_tags
=== PAUSE TestAccRoute53RecoveryReadinessResourceSet_tags
=== CONT  TestAccRoute53RecoveryReadinessResourceSet_tags
=== CONT  TestAccRoute53RecoveryReadinessCell_basic
--- PASS: TestAccRoute53RecoveryReadinessCell_basic (40.94s)
=== CONT  TestAccRoute53RecoveryReadinessRecoveryGroup_basic
--- PASS: TestAccRoute53RecoveryReadinessRecoveryGroup_basic (40.81s)
=== CONT  TestAccRoute53RecoveryReadinessResourceSet_basic
--- PASS: TestAccRoute53RecoveryReadinessResourceSet_tags (92.67s)
=== CONT  TestAccRoute53RecoveryReadinessRecoveryGroup_tags
--- PASS: TestAccRoute53RecoveryReadinessResourceSet_basic (31.17s)
=== CONT  TestAccRoute53RecoveryReadinessCell_tags
--- PASS: TestAccRoute53RecoveryReadinessRecoveryGroup_tags (85.17s)
=== CONT  TestAccRoute53RecoveryReadinessReadinessCheck_tags
--- PASS: TestAccRoute53RecoveryReadinessCell_tags (89.36s)
=== CONT  TestAccRoute53RecoveryReadinessReadinessCheck_basic
--- PASS: TestAccRoute53RecoveryReadinessReadinessCheck_basic (43.84s)
--- PASS: TestAccRoute53RecoveryReadinessReadinessCheck_tags (90.00s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/route53recoveryreadiness	282.209s
% make testacc TESTARGS='-run=_basic$$\|_tags$$' PKG=devicefarm ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/devicefarm/... -v -count 1 -parallel 2  -run=_basic$\|_tags$ -timeout 180m
=== RUN   TestAccDeviceFarmDevicePool_basic
=== PAUSE TestAccDeviceFarmDevicePool_basic
=== RUN   TestAccDeviceFarmDevicePool_tags
=== PAUSE TestAccDeviceFarmDevicePool_tags
=== RUN   TestAccDeviceFarmInstanceProfile_basic
=== PAUSE TestAccDeviceFarmInstanceProfile_basic
=== RUN   TestAccDeviceFarmInstanceProfile_tags
=== PAUSE TestAccDeviceFarmInstanceProfile_tags
=== RUN   TestAccDeviceFarmNetworkProfile_basic
=== PAUSE TestAccDeviceFarmNetworkProfile_basic
=== RUN   TestAccDeviceFarmNetworkProfile_tags
=== PAUSE TestAccDeviceFarmNetworkProfile_tags
=== RUN   TestAccDeviceFarmProject_basic
=== PAUSE TestAccDeviceFarmProject_basic
=== RUN   TestAccDeviceFarmProject_tags
=== PAUSE TestAccDeviceFarmProject_tags
=== RUN   TestAccDeviceFarmTestGridProject_basic
=== PAUSE TestAccDeviceFarmTestGridProject_basic
=== RUN   TestAccDeviceFarmTestGridProject_tags
=== PAUSE TestAccDeviceFarmTestGridProject_tags
=== RUN   TestAccDeviceFarmUpload_basic
=== PAUSE TestAccDeviceFarmUpload_basic
=== CONT  TestAccDeviceFarmDevicePool_basic
=== CONT  TestAccDeviceFarmProject_basic
--- PASS: TestAccDeviceFarmProject_basic (27.78s)
=== CONT  TestAccDeviceFarmTestGridProject_tags
--- PASS: TestAccDeviceFarmDevicePool_basic (36.52s)
=== CONT  TestAccDeviceFarmUpload_basic
--- PASS: TestAccDeviceFarmUpload_basic (27.23s)
=== CONT  TestAccDeviceFarmTestGridProject_basic
--- PASS: TestAccDeviceFarmTestGridProject_tags (37.32s)
=== CONT  TestAccDeviceFarmInstanceProfile_tags
--- PASS: TestAccDeviceFarmTestGridProject_basic (26.57s)
=== CONT  TestAccDeviceFarmNetworkProfile_tags
--- PASS: TestAccDeviceFarmInstanceProfile_tags (37.40s)
=== CONT  TestAccDeviceFarmNetworkProfile_basic
--- PASS: TestAccDeviceFarmNetworkProfile_tags (38.87s)
=== CONT  TestAccDeviceFarmProject_tags
--- PASS: TestAccDeviceFarmNetworkProfile_basic (28.69s)
=== CONT  TestAccDeviceFarmInstanceProfile_basic
--- PASS: TestAccDeviceFarmInstanceProfile_basic (27.41s)
=== CONT  TestAccDeviceFarmDevicePool_tags
--- PASS: TestAccDeviceFarmProject_tags (38.97s)
--- PASS: TestAccDeviceFarmDevicePool_tags (47.08s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/devicefarm	211.173s

@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added generators Relates to code generators. service/ds Issues and PRs that pertain to the ds service. service/glacier Issues and PRs that pertain to the glacier service. service/kinesis Issues and PRs that pertain to the kinesis service. labels Apr 21, 2023
@github-actions github-actions bot added service/logs Issues and PRs that pertain to the logs service. service/opsworks Issues and PRs that pertain to the opsworks service. service/route53 Issues and PRs that pertain to the route53 service. service/route53recoveryreadiness Issues and PRs that pertain to the route53recoveryreadiness service. service/ssm Issues and PRs that pertain to the ssm service. service/vpc Issues and PRs that pertain to the vpc service. tags Pertains to resource tagging. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/XL Managed by automation to categorize the size of a PR. labels Apr 21, 2023
@github-actions github-actions bot added service/devicefarm Issues and PRs that pertain to the devicefarm service. service/directconnect Issues and PRs that pertain to the directconnect service. labels Apr 21, 2023
@ewbankkit ewbankkit merged commit cec8355 into main Apr 21, 2023
@ewbankkit ewbankkit deleted the td-generate-createTags branch April 21, 2023 23:15
@github-actions github-actions bot added this to the v4.65.0 milestone Apr 21, 2023
github-actions bot pushed a commit that referenced this pull request Apr 21, 2023
@github-actions
Copy link

This functionality has been released in v4.65.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
generators Relates to code generators. service/devicefarm Issues and PRs that pertain to the devicefarm service. service/directconnect Issues and PRs that pertain to the directconnect service. service/ds Issues and PRs that pertain to the ds service. service/glacier Issues and PRs that pertain to the glacier service. service/kinesis Issues and PRs that pertain to the kinesis service. service/logs Issues and PRs that pertain to the logs service. service/opsworks Issues and PRs that pertain to the opsworks service. service/route53recoveryreadiness Issues and PRs that pertain to the route53recoveryreadiness service. service/route53 Issues and PRs that pertain to the route53 service. service/ssm Issues and PRs that pertain to the ssm service. service/vpc Issues and PRs that pertain to the vpc service. size/XL Managed by automation to categorize the size of a PR. tags Pertains to resource tagging. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant