Skip to content

ServicePackageResourceRegion: Use factory functions #42548

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

Merged
merged 15 commits into from
May 13, 2025

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented May 8, 2025

Description

Instead of emitting ServicePackageResourceRegion structures with fields set directly, for the most common cases of per-resource Region override enabled with validation and per-resource Region override disabled, emit calls to standard factory functions.

Also restores the region attribute to the aws_cloudfront_log_delivery_canonical_user_id which must be handled in the data source as the CloudFront service is global.

Relations

Relates #42493.

Output from Acceptance Testing

% make testacc TESTARGS='-run=TestAccELBV2HostedZoneIDDataSource_' PKG=elbv2
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.24.2 test ./internal/service/elbv2/... -v -count 1 -parallel 20  -run=TestAccELBV2HostedZoneIDDataSource_ -timeout 360m -vet=off
2025/05/13 09:52:32 Creating Terraform AWS Provider (SDKv2-style)...
2025/05/13 09:52:32 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccELBV2HostedZoneIDDataSource_basic
=== PAUSE TestAccELBV2HostedZoneIDDataSource_basic
=== CONT  TestAccELBV2HostedZoneIDDataSource_basic
--- PASS: TestAccELBV2HostedZoneIDDataSource_basic (26.16s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/elbv2	31.004s   
% make testacc TESTARGS='-run=TestAccCloudFrontLogDeliveryCanonicalUserIDDataSource_' PKG=cloudfront
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.24.2 test ./internal/service/cloudfront/... -v -count 1 -parallel 20  -run=TestAccCloudFrontLogDeliveryCanonicalUserIDDataSource_ -timeout 360m -vet=off
2025/05/13 09:49:18 Creating Terraform AWS Provider (SDKv2-style)...
2025/05/13 09:49:18 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccCloudFrontLogDeliveryCanonicalUserIDDataSource_basic
=== PAUSE TestAccCloudFrontLogDeliveryCanonicalUserIDDataSource_basic
=== RUN   TestAccCloudFrontLogDeliveryCanonicalUserIDDataSource_default
=== PAUSE TestAccCloudFrontLogDeliveryCanonicalUserIDDataSource_default
=== RUN   TestAccCloudFrontLogDeliveryCanonicalUserIDDataSource_cn
=== PAUSE TestAccCloudFrontLogDeliveryCanonicalUserIDDataSource_cn
=== CONT  TestAccCloudFrontLogDeliveryCanonicalUserIDDataSource_basic
=== CONT  TestAccCloudFrontLogDeliveryCanonicalUserIDDataSource_cn
=== CONT  TestAccCloudFrontLogDeliveryCanonicalUserIDDataSource_default
--- PASS: TestAccCloudFrontLogDeliveryCanonicalUserIDDataSource_cn (8.56s)
--- PASS: TestAccCloudFrontLogDeliveryCanonicalUserIDDataSource_basic (8.57s)
--- PASS: TestAccCloudFrontLogDeliveryCanonicalUserIDDataSource_default (8.58s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/cloudfront	13.410s
% AWS_DEFAULT_REGION=us-east-1 make testacc TESTARGS='-run=TestAccAppFabric_serial/^AppBundle$$/basic\|TestAccAppFabric_serial/^AppBundle$$/upgradeFromV5\|TestAccAppFabric_serial/^AppBundle$$/region' PKG=appfabric
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.24.2 test ./internal/service/appfabric/... -v -count 1 -parallel 20  -run=TestAccAppFabric_serial/^AppBundle$/basic\|TestAccAppFabric_serial/^AppBundle$/upgradeFromV5\|TestAccAppFabric_serial/^AppBundle$/region -timeout 360m -vet=off
2025/05/13 09:54:59 Creating Terraform AWS Provider (SDKv2-style)...
2025/05/13 09:54:59 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccAppFabric_serial
=== PAUSE TestAccAppFabric_serial
=== CONT  TestAccAppFabric_serial
=== RUN   TestAccAppFabric_serial/AppBundle
=== RUN   TestAccAppFabric_serial/AppBundle/basic
=== RUN   TestAccAppFabric_serial/AppBundle/regionCreateNull
=== RUN   TestAccAppFabric_serial/AppBundle/regionCreateNonNull
=== RUN   TestAccAppFabric_serial/AppBundle/upgradeFromV5
--- PASS: TestAccAppFabric_serial (147.50s)
    --- PASS: TestAccAppFabric_serial/AppBundle (147.50s)
        --- PASS: TestAccAppFabric_serial/AppBundle/basic (21.52s)
        --- PASS: TestAccAppFabric_serial/AppBundle/regionCreateNull (41.53s)
        --- PASS: TestAccAppFabric_serial/AppBundle/regionCreateNonNull (32.47s)
        --- PASS: TestAccAppFabric_serial/AppBundle/upgradeFromV5 (51.98s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/appfabric	152.436s
% make testacc TESTARGS='-run=TestAccVPC_basic\|TestAccVPC_region\|TestAccVPC_upgrade' PKG=ec2
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.24.2 test ./internal/service/ec2/... -v -count 1 -parallel 20  -run=TestAccVPC_basic\|TestAccVPC_region\|TestAccVPC_upgrade -timeout 360m -vet=off
2025/05/13 09:58:50 Creating Terraform AWS Provider (SDKv2-style)...
2025/05/13 09:58:50 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccVPC_basic
=== PAUSE TestAccVPC_basic
=== RUN   TestAccVPC_upgradeFromV5
=== PAUSE TestAccVPC_upgradeFromV5
=== RUN   TestAccVPC_regionCreateNull
=== PAUSE TestAccVPC_regionCreateNull
=== RUN   TestAccVPC_regionCreateNonNull
=== PAUSE TestAccVPC_regionCreateNonNull
=== CONT  TestAccVPC_basic
=== CONT  TestAccVPC_regionCreateNull
=== CONT  TestAccVPC_regionCreateNonNull
=== CONT  TestAccVPC_upgradeFromV5
--- PASS: TestAccVPC_basic (19.22s)
--- PASS: TestAccVPC_regionCreateNonNull (34.67s)
--- PASS: TestAccVPC_regionCreateNull (47.84s)
--- PASS: TestAccVPC_upgradeFromV5 (52.02s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	57.024s

@ewbankkit ewbankkit requested a review from a team as a code owner May 8, 2025 19:38
Copy link

github-actions bot commented May 8, 2025

Community Guidelines

This comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀

Voting for Prioritization

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

Copy link

github-actions bot commented May 8, 2025

⚠️ We've detected the following potential issues with your pull request

Changelog Entry Required

The proposed change requires a changelog entry. Please see the Changelog Process section of the contributing guide for information on the changelog generation process.

@github-actions github-actions bot added prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. service/ecs Issues and PRs that pertain to the ecs service. service/emr Issues and PRs that pertain to the emr service. service/configservice Issues and PRs that pertain to the configservice service. service/elbv2 Issues and PRs that pertain to the elbv2 service. service/apigateway Issues and PRs that pertain to the apigateway service. service/dax Issues and PRs that pertain to the dax service. service/directconnect Issues and PRs that pertain to the directconnect service. service/codebuild Issues and PRs that pertain to the codebuild service. service/cloudtrail Issues and PRs that pertain to the cloudtrail service. service/acm Issues and PRs that pertain to the acm service. service/elb Issues and PRs that pertain to the elb service. service/cloudfront Issues and PRs that pertain to the cloudfront service. service/elasticbeanstalk Issues and PRs that pertain to the elasticbeanstalk service. service/athena Issues and PRs that pertain to the athena service. service/codecommit Issues and PRs that pertain to the codecommit service. service/autoscaling Issues and PRs that pertain to the autoscaling service. service/dynamodb Issues and PRs that pertain to the dynamodb service. service/cloudwatch Issues and PRs that pertain to the cloudwatch service. service/cloudsearch Issues and PRs that pertain to the cloudsearch service. service/efs Issues and PRs that pertain to the efs service. service/budgets Issues and PRs that pertain to the budgets service. service/appsync Issues and PRs that pertain to the appsync service. service/elasticache Issues and PRs that pertain to the elasticache service. service/codepipeline Issues and PRs that pertain to the codepipeline service. labels May 8, 2025
@github-actions github-actions bot added service/appfabric Issues and PRs that pertain to the appfabric service. service/bedrockagent Issues and PRs that pertain to the bedrockagent service. service/costoptimizationhub Issues and PRs that pertain to the costoptimizationhub service. service/cloudfrontkeyvaluestore Issues and PRs that pertain to the cloudfrontkeyvaluestore service. service/datazone Issues and PRs that pertain to the datazone service. service/bcmdataexports Issues and PRs that pertain to the bcmdataexports service. service/chatbot Issues and PRs that pertain to the chatbot service. service/codeconnections Issues and PRs that pertain to the codeconnections service. service/billing Issues and PRs that pertain to the billing service. labels May 8, 2025
@ewbankkit ewbankkit changed the title ServicePackageResourceRegion: Only set fields for exceptions ServicePackageResourceRegion: Use factory methods May 13, 2025
@ewbankkit ewbankkit changed the title ServicePackageResourceRegion: Use factory methods ServicePackageResourceRegion: Use factory functions May 13, 2025
Copy link
Member

@jar-b jar-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@ewbankkit ewbankkit merged commit 5357ad5 into release/6.0.0-beta May 13, 2025
64 checks passed
@ewbankkit ewbankkit deleted the td-new-ServicePackageRegion-field-names branch May 13, 2025 17:40
Copy link

Warning

This Issue has been closed, meaning that any additional comments are much easier for the maintainers to miss. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v6.0.0-beta2 milestone May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
generators Relates to code generators. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. provider Pertains to the provider itself, rather than any interaction with AWS. service/accessanalyzer Issues and PRs that pertain to the accessanalyzer service. service/account Issues and PRs that pertain to the account service. service/acm Issues and PRs that pertain to the acm service. service/acmpca Issues and PRs that pertain to the acmpca service. service/amp Issues and PRs that pertain to the amp service. service/amplify Issues and PRs that pertain to the amplify service. service/apigateway Issues and PRs that pertain to the apigateway service. service/apigatewayv2 Issues and PRs that pertain to the apigatewayv2 service. service/appautoscaling Issues and PRs that pertain to the appautoscaling service. service/appconfig Issues and PRs that pertain to the appconfig service. service/appfabric Issues and PRs that pertain to the appfabric service. service/appflow Issues and PRs that pertain to the appflow service. service/appintegrations Issues and PRs that pertain to the appintegrations service. service/applicationinsights Issues and PRs that pertain to the applicationinsights service. service/appmesh Issues and PRs that pertain to the appmesh service. service/apprunner Issues and PRs that pertain to the apprunner service. service/appstream Issues and PRs that pertain to the appstream service. service/appsync Issues and PRs that pertain to the appsync service. service/athena Issues and PRs that pertain to the athena service. service/auditmanager Issues and PRs that pertain to the auditmanager service. service/autoscaling Issues and PRs that pertain to the autoscaling service. service/autoscalingplans Issues and PRs that pertain to the autoscalingplans service. service/backup Issues and PRs that pertain to the backup service. service/batch Issues and PRs that pertain to the batch service. service/bcmdataexports Issues and PRs that pertain to the bcmdataexports service. service/bedrock Issues and PRs that pertain to the bedrock service. service/bedrockagent Issues and PRs that pertain to the bedrockagent service. service/billing Issues and PRs that pertain to the billing service. service/budgets Issues and PRs that pertain to the budgets service. service/ce Issues and PRs that pertain to the ce service. service/chatbot Issues and PRs that pertain to the chatbot service. service/chime Issues and PRs that pertain to the chime service. service/chimesdkmediapipelines Issues and PRs that pertain to the chimesdkmediapipelines service. service/chimesdkvoice Issues and PRs that pertain to the chimesdkvoice service. service/cleanrooms Issues and PRs that pertain to the cleanrooms service. service/cloud9 Issues and PRs that pertain to the cloud9 service. service/cloudcontrol Issues and PRs that pertain to the cloudcontrol service. service/cloudformation Issues and PRs that pertain to the cloudformation service. service/cloudfront Issues and PRs that pertain to the cloudfront service. service/cloudfrontkeyvaluestore Issues and PRs that pertain to the cloudfrontkeyvaluestore service. service/cloudhsmv2 Issues and PRs that pertain to the cloudhsmv2 service. service/cloudsearch Issues and PRs that pertain to the cloudsearch service. service/cloudtrail Issues and PRs that pertain to the cloudtrail service. service/cloudwatch Issues and PRs that pertain to the cloudwatch service. service/codeartifact Issues and PRs that pertain to the codeartifact service. service/codebuild Issues and PRs that pertain to the codebuild service. service/codecatalyst Issues and PRs that pertain to the codecatalyst service. service/codecommit Issues and PRs that pertain to the codecommit service. service/codeconnections Issues and PRs that pertain to the codeconnections service. service/codeguruprofiler Issues and PRs that pertain to the codeguruprofiler service. service/codegurureviewer Issues and PRs that pertain to the codegurureviewer service. service/codepipeline Issues and PRs that pertain to the codepipeline service. service/codestarconnections Issues and PRs that pertain to the codestarconnections service. service/codestarnotifications Issues and PRs that pertain to the codestarnotifications service. service/cognitoidentity Issues and PRs that pertain to the cognitoidentity service. service/cognitoidp Issues and PRs that pertain to the cognitoidp service. service/comprehend Issues and PRs that pertain to the comprehend service. service/computeoptimizer Issues and PRs that pertain to the computeoptimizer service. service/configservice Issues and PRs that pertain to the configservice service. service/connect Issues and PRs that pertain to the connect service. service/controltower Issues and PRs that pertain to the controltower service. service/costoptimizationhub Issues and PRs that pertain to the costoptimizationhub service. service/cur Issues and PRs that pertain to the cur service. service/customerprofiles Issues and PRs that pertain to the customerprofiles service. service/dataexchange Issues and PRs that pertain to the dataexchange service. service/datapipeline Issues and PRs that pertain to the datapipeline service. service/datasync Issues and PRs that pertain to the datasync service. service/datazone Issues and PRs that pertain to the datazone service. service/dax Issues and PRs that pertain to the dax service. service/deploy Issues and PRs that pertain to the deploy service. service/detective Issues and PRs that pertain to the detective service. service/devicefarm Issues and PRs that pertain to the devicefarm service. service/devopsguru Issues and PRs that pertain to the devopsguru service. service/directconnect Issues and PRs that pertain to the directconnect service. service/dlm Issues and PRs that pertain to the dlm service. service/dms Issues and PRs that pertain to the dms service. service/docdb Issues and PRs that pertain to the docdb service. service/docdbelastic Issues and PRs that pertain to the docdbelastic service. service/drs Issues and PRs that pertain to the drs service. service/ds Issues and PRs that pertain to the ds service. service/dynamodb Issues and PRs that pertain to the dynamodb service. service/ecr Issues and PRs that pertain to the ecr service. service/ecrpublic Issues and PRs that pertain to the ecrpublic service. service/ecs Issues and PRs that pertain to the ecs service. service/efs Issues and PRs that pertain to the efs service. service/eks Issues and PRs that pertain to the eks service. service/elasticache Issues and PRs that pertain to the elasticache service. service/elasticbeanstalk Issues and PRs that pertain to the elasticbeanstalk service. service/elasticsearch Issues and PRs that pertain to the elasticsearch service. service/elastictranscoder Issues and PRs that pertain to the elastictranscoder service. service/elb Issues and PRs that pertain to the elb service. service/elbv2 Issues and PRs that pertain to the elbv2 service. service/emr Issues and PRs that pertain to the emr service. service/emrcontainers Issues and PRs that pertain to the emrcontainers service. service/emrserverless Issues and PRs that pertain to the emrserverless service. service/events Issues and PRs that pertain to the events service. service/evidently Issues and PRs that pertain to the evidently service.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants