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

Provider multiplexing - Phase 1 #25715

Merged
merged 24 commits into from
Jul 14, 2022

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Jul 6, 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 #25606.

Introduces a minimal second step for combining (using terraform-plugin-mux) into a single binary the current resource and data sources implemented using Terraform Plugin SDK v2 with other future implementations (such as using Terraform Plugin Framework).

% 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 (21.90s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	28.305s

This PR

  • Introduces (in internal/provider/fwprovider) a minimal provider implementation that uses the Terraform Plugin Framework and multiplexes it with the current Terraform Plugin SDK v2-based provider's server. This new skeleton provider
    • Implements 0 resources and data sources
    • Is required to declare a provider schema that is identical to the schema(s) declared by all other providers in the muxed provider server
  • Removes Default values from the Terraform Plugin SDK v2-based provider's schema declaration as the Terraform Framework-based provider does not have that facility. All but max_retries were declaring superfluous zero value defaults. The max_retries default value of 25 is now handled in the provider's ConfigureFunc
Primary Provider

Now that more than 1 provider is being multiplexed into a single provider server I have introduced the idea of the primary provider. The (single) primary provider in the mux set is the provider which parses the practitioner-provided provider configuration block (provider "aws" { ... }) and holds the provider instance state (currently conns.AWSClient). The other, secondary, members of the mux set can use the provider instance state through a reference to the primary provider (via a suitable interface), injected on construction. The secondary providers need do nothing in their own Configure methods.

@github-actions github-actions bot added provider Pertains to the provider itself, rather than any interaction with AWS. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/XL Managed by automation to categorize the size of a PR. and removed tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. provider Pertains to the provider itself, rather than any interaction with AWS. labels Jul 6, 2022
@github-actions github-actions bot added provider Pertains to the provider itself, rather than any interaction with AWS. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Jul 6, 2022
@ewbankkit ewbankkit marked this pull request as ready for review July 6, 2022 18:17
@ewbankkit
Copy link
Contributor Author

% make semall providerlint golangci-lint
==> Running Semgrep checks locally (must have semgrep installed)...
Scanning 4065 files with 37 go rules.
  100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████|4065/4065 tasks

Some files were skipped or only partially analyzed.
  Scan was limited to files tracked by git.
  Scan skipped: 1613 files matching .semgrepignore patterns
  For a full list of skipped files, run semgrep with the --verbose flag.

Ran 37 rules on 4065 files: 0 findings.
If Semgrep missed a finding, please send us feedback to let us know!
  $ semgrep shouldafound --help
Scanning 4065 files with 24 go rules.
  100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████|4065/4065 tasks

Some files were skipped or only partially analyzed.
  Scan was limited to files tracked by git.
  Scan skipped: 1613 files matching .semgrepignore patterns
  For a full list of skipped files, run semgrep with the --verbose flag.

Ran 24 rules on 4065 files: 0 findings.
If Semgrep missed a finding, please send us feedback to let us know!
  $ semgrep shouldafound --help
Scanning 1543 files with 4 go rules.
  100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████|1543/1543 tasks

Some files were skipped or only partially analyzed.
  Scan was limited to files tracked by git.
  Scan skipped: 1613 files matching .semgrepignore patterns
  For a full list of skipped files, run semgrep with the --verbose flag.

Ran 4 rules on 1543 files: 0 findings.
If Semgrep missed a finding, please send us feedback to let us know!
  $ semgrep shouldafound --help
Scanning 924 files with 201 go rules.
  100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████|924/924 tasks

Some files were skipped or only partially analyzed.
  Scan was limited to files tracked by git.
  Scan skipped: 1613 files matching .semgrepignore patterns
  For a full list of skipped files, run semgrep with the --verbose flag.

Ran 201 rules on 924 files: 0 findings.
If Semgrep missed a finding, please send us feedback to let us know!
  $ semgrep shouldafound --help
Scanning 1072 files with 200 go rules.
  100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████|1072/1072 tasks

Some files were skipped or only partially analyzed.
  Scan was limited to files tracked by git.
  Scan skipped: 1613 files matching .semgrepignore patterns
  For a full list of skipped files, run semgrep with the --verbose flag.

Ran 201 rules on 1072 files: 0 findings.
If Semgrep missed a finding, please send us feedback to let us know!
  $ semgrep shouldafound --help
Scanning 838 files with 197 go rules.
  100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████|838/838 tasks

Some files were skipped or only partially analyzed.
  Scan was limited to files tracked by git.
  Scan skipped: 1613 files matching .semgrepignore patterns
  For a full list of skipped files, run semgrep with the --verbose flag.

Ran 201 rules on 838 files: 0 findings.
If Semgrep missed a finding, please send us feedback to let us know!
  $ semgrep shouldafound --help
Scanning 1115 files with 201 go rules.
  100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████|1115/1115 tasks

Some files were skipped or only partially analyzed.
  Scan was limited to files tracked by git.
  Scan skipped: 1613 files matching .semgrepignore patterns
  For a full list of skipped files, run semgrep with the --verbose flag.

Ran 201 rules on 1115 files: 0 findings.
If Semgrep missed a finding, please send us feedback to let us know!
  $ semgrep shouldafound --help
==> Checking source code with providerlint...
==> Checking source code with golangci-lint...

ewbankkit added 2 commits July 7, 2022 10:18
Acceptance test output:

% 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.00s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	31.950s
@github-actions github-actions bot added service/vpc Issues and PRs that pertain to the vpc service. and removed service/vpc Issues and PRs that pertain to the vpc service. labels Jul 7, 2022
@github-actions github-actions bot added the service/vpc Issues and PRs that pertain to the vpc service. label Jul 13, 2022
@ewbankkit ewbankkit merged commit 8199891 into main Jul 14, 2022
@ewbankkit ewbankkit deleted the f-protov5-mux-terraform-plugin-framework-phase1 branch July 14, 2022 00:03
@github-actions github-actions bot added this to the v4.23.0 milestone Jul 14, 2022
github-actions bot pushed a commit that referenced this pull request Jul 14, 2022
@github-actions
Copy link

This functionality has been released in v4.23.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 Aug 22, 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/vpc Issues and PRs that pertain to the vpc 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