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

d/aws_arn: Migrate to Terraform Plugin Framework #26027

Merged
merged 25 commits into from
Aug 1, 2022

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Jul 28, 2022

Community Note

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

Relates #23948.
Relates #25951.
Relates #25770.
Relates #25715.
Relates #25606.

This PR migrates the relatively trivial aws_arn data source from Terraform Plugin SDK v2 to Terraform Plugin Framework.
The signature of the SDK v2 provider factory function changes (adding a context.Context argument and returning an additional error), hence the number of sources files modified (mostly acceptance tests).

Output from acceptance testing:

% make testacc TESTARGS='-run=TestAccVPC_basic' PKG=ec2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 20  -run=TestAccVPC_basic -timeout 180m
=== RUN   TestAccVPC_basic
=== PAUSE TestAccVPC_basic
=== CONT  TestAccVPC_basic
--- PASS: TestAccVPC_basic (25.95s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	32.081s
% make testacc TESTARGS='-run=TestAccMetaARNDataSource_' PKG=meta ACCTEST_PARALLELISM=2 
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/meta/... -v -count 1 -parallel 2  -run=TestAccMetaARNDataSource_ -timeout 180m
=== RUN   TestAccMetaARNDataSource_basic
=== PAUSE TestAccMetaARNDataSource_basic
=== RUN   TestAccMetaARNDataSource_s3Bucket
=== PAUSE TestAccMetaARNDataSource_s3Bucket
=== CONT  TestAccMetaARNDataSource_basic
=== CONT  TestAccMetaARNDataSource_s3Bucket
--- PASS: TestAccMetaARNDataSource_basic (11.85s)
--- PASS: TestAccMetaARNDataSource_s3Bucket (11.89s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/meta	15.972s
% make testacc TESTARGS='-run=TestAccLightsailDomain_basic' PKG=lightsail ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/lightsail/... -v -count 1 -parallel 2  -run=TestAccLightsailDomain_basic -timeout 180m
=== RUN   TestAccLightsailDomain_basic
=== PAUSE TestAccLightsailDomain_basic
=== CONT  TestAccLightsailDomain_basic
--- PASS: TestAccLightsailDomain_basic (35.92s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/lightsail	40.495s

To consider next:

  • Move the ARNType (and DurationType used in provider configuration) into a shared types package (internal/types)?
  • Resource (and data source) self-registration
  • Accessing the configured provider data - e.g. the AWS Region for the aws_region data source

ewbankkit added 25 commits July 22, 2022 12:06
Acceptance test output:

% go test -v -run=TestARNType ./internal/service/meta
=== RUN   TestARNTypeValueFromTerraform
=== PAUSE TestARNTypeValueFromTerraform
=== RUN   TestARNTypeValidate
=== PAUSE TestARNTypeValidate
=== CONT  TestARNTypeValueFromTerraform
=== CONT  TestARNTypeValidate
=== RUN   TestARNTypeValueFromTerraform/invalid_duration
=== RUN   TestARNTypeValidate/not_a_string
=== RUN   TestARNTypeValueFromTerraform/null_value
=== RUN   TestARNTypeValidate/unknown_string
=== RUN   TestARNTypeValidate/null_string
=== RUN   TestARNTypeValueFromTerraform/unknown_value
=== RUN   TestARNTypeValidate/valid_string
=== RUN   TestARNTypeValidate/invalid_string
--- PASS: TestARNTypeValidate (0.00s)
    --- PASS: TestARNTypeValidate/not_a_string (0.00s)
    --- PASS: TestARNTypeValidate/unknown_string (0.00s)
    --- PASS: TestARNTypeValidate/null_string (0.00s)
    --- PASS: TestARNTypeValidate/valid_string (0.00s)
    --- PASS: TestARNTypeValidate/invalid_string (0.00s)
=== RUN   TestARNTypeValueFromTerraform/valid_ARN
--- PASS: TestARNTypeValueFromTerraform (0.00s)
    --- PASS: TestARNTypeValueFromTerraform/invalid_duration (0.00s)
    --- PASS: TestARNTypeValueFromTerraform/null_value (0.00s)
    --- PASS: TestARNTypeValueFromTerraform/unknown_value (0.00s)
    --- PASS: TestARNTypeValueFromTerraform/valid_ARN (0.00s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/meta	4.186s
…ProviderFactories: acctest.ProtoV5ProviderFactories'.
…; Per-service acceptance test initialization.
@github-actions github-actions bot added provider Pertains to the provider itself, rather than any interaction with AWS. service/apigateway Issues and PRs that pertain to the apigateway service. service/cognitoidp Issues and PRs that pertain to the cognitoidp service. service/cur Issues and PRs that pertain to the cur service. service/directconnect Issues and PRs that pertain to the directconnect service. labels Jul 28, 2022
@github-actions github-actions bot added service/docdb Issues and PRs that pertain to the docdb service. service/efs Issues and PRs that pertain to the efs service. service/fms Issues and PRs that pertain to the fms service. service/lightsail Issues and PRs that pertain to the lightsail service. service/meta service/pricing Issues and PRs that pertain to the pricing service. service/rds Issues and PRs that pertain to the rds service. service/route53 Issues and PRs that pertain to the route53 service. service/s3 Issues and PRs that pertain to the s3 service. service/vpc Issues and PRs that pertain to the vpc service. service/waf Issues and PRs that pertain to the waf service. 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 Jul 28, 2022
@ewbankkit ewbankkit merged commit 8ad8580 into main Aug 1, 2022
@ewbankkit ewbankkit deleted the f-terraform-plugin-framework-simple-data-source branch August 1, 2022 13:05
@github-actions github-actions bot added this to the v4.25.0 milestone Aug 1, 2022
@github-actions
Copy link

github-actions bot commented Aug 4, 2022

This functionality has been released in v4.25.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

github-actions bot commented Sep 4, 2022

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 Sep 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
provider Pertains to the provider itself, rather than any interaction with AWS. service/apigateway Issues and PRs that pertain to the apigateway service. service/cognitoidp Issues and PRs that pertain to the cognitoidp service. service/cur Issues and PRs that pertain to the cur service. service/directconnect Issues and PRs that pertain to the directconnect service. service/docdb Issues and PRs that pertain to the docdb service. service/efs Issues and PRs that pertain to the efs service. service/fms Issues and PRs that pertain to the fms service. service/lightsail Issues and PRs that pertain to the lightsail service. service/pricing Issues and PRs that pertain to the pricing service. service/rds Issues and PRs that pertain to the rds service. service/route53 Issues and PRs that pertain to the route53 service. service/s3 Issues and PRs that pertain to the s3 service. service/vpc Issues and PRs that pertain to the vpc service. service/waf Issues and PRs that pertain to the waf service. size/XL Managed by automation to categorize the size of a PR. 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