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: introduce a muxed client #3262

Merged
merged 3 commits into from
Apr 24, 2024
Merged

Conversation

jacobbednarz
Copy link
Member

With the announcement of the cloudflare-go/v2, we need to introduce a
way to use both versions of the SDK in the provider. This moves us to a
world where the v1 and v2 of the clients can coexist and still be
initialised in a consistent fashion.

At a high level, the guidance for modifying resources and datasources is:

  • If you have an existing resource, use the cloudflare-go V1 SDK which
    whatever version of the Terraform SDK/framework version you have
    today.
  • If you have a new resource, build it using cloudflare-go V2 SDK and
    the terraform-plugin-framework.

While this commit is rather large by LOC, it is the following changes
but made across the provider.

  • Introduce a muxclient package. Allows Terraform internals to have a
    single client instead of trying to swap on the fly potentially causing
    concurrency issues.
  • Split acctest.SharedClient into SharedV1Client and SharedV2Client
    for use in both versions of acceptance tests.
  • Aliases and namespacing to handle the different package versions.

These changes should be internal and not end user facing.

Copy link
Contributor

changelog detected ✅

With the announcement of the cloudflare-go/v2[1], we need to introduce a
way to use both versions of the SDK in the provider. This moves us to a
world where the v1 and v2 of the clients can coexist and still be
initialised in a consistent fashion.

At a high level, the guidance for modifying resources and datasources is:

- If you have an existing resource, use the cloudflare-go V1 SDK which
  whatever version of the Terraform SDK/framework version you have
  today.
- If you have a new resource, build it using cloudflare-go V2 SDK and
  the terraform-plugin-framework.

While this commit is rather large by LOC, it is the following changes
but made across the provider.

- Introduce a `muxclient` package. Allows Terraform internals to have a
  single client instead of trying to swap on the fly potentially causing
  concurrency issues.
- Split `acctest.SharedClient` into `SharedV1Client` and `SharedV2Client`
  for use in both versions of acceptance tests.
- Aliases and namespacing to handle the different package versions.

These changes should be internal and not end user facing.
[1]: https://blog.cloudflare.com/workers-production-safety
@jacobbednarz jacobbednarz merged commit f83af2d into master Apr 24, 2024
9 of 10 checks passed
@jacobbednarz jacobbednarz deleted the mux-cloudflare-go-versions branch April 24, 2024 02:19
@github-actions github-actions bot added this to the v4.31.0 milestone Apr 24, 2024
github-actions bot pushed a commit that referenced this pull request Apr 24, 2024
alyssamw pushed a commit to alyssamw/terraform-provider-cloudflare that referenced this pull request Apr 24, 2024
Copy link
Contributor

github-actions bot commented May 1, 2024

This functionality has been released in v4.31.0 of the Terraform Cloudflare 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 github-actions bot locked as resolved and limited conversation to collaborators May 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant