all: create a Mux terraform for Terraform SDKv2 + plugin framework#645
all: create a Mux terraform for Terraform SDKv2 + plugin framework#645alexwlchan merged 1 commit intomainfrom
Conversation
011f3df to
a6463fe
Compare
| // Don't require any of the global configuration | ||
| p.Schema = nil |
There was a problem hiding this comment.
Because Terraform checks that the schema is consistent across the muxed providers, our old strategy of deleting the schema for the tests doesn't
work; instead, we set an API key via environment variable. The t.Setenv helper can't be used in parallel, so we have to switch parallel tests to
serial.
There was a problem hiding this comment.
I think this was originally done for our "unit tests" (e.g., those marked with IsUnitTest: true in resource.TestCase) as they don't run against a real server but do use the Terraform acceptance testing logic.
I think we can likely remove most (if not all) tests of this form as a followup / cleanup action since they don't provide much actual value vs. acceptance tests. E.g., they are a very bare minimum check that a plan / apply can succeed against a completely mocked out server that does not actually return data in the correct shape.
There was a problem hiding this comment.
I'm going to leave that for a separate PR, rather than stack new changes into this patch.
One reason we might want to keep them: AIUI we don't currently run acceptance tests against PRs? So those minimal tests give us some safety net that something isn't completely broken when we do small patches (e.g. adding Fleet and Huntress last week).
There was a problem hiding this comment.
That sounds good to me! Yeah we don't currently have an automated way of running acceptance tests against PRs aside from the manual workflow trigger in corp.
Something I've wanted for a bit but not had the time to explore further is adding a GitHub app / bot that listens for PRs here, downloads the repo at the branch, and runs the acceptance test flows (assuming that the author is a contributor or that we have explicitly approved running against a branch from a fork). This is an even further in the future thing, but would be a lot nicer UX for PRs here if / when we have it 🙂
8212eaf to
36fa76e
Compare
| // Don't require any of the global configuration | ||
| p.Schema = nil |
There was a problem hiding this comment.
I think this was originally done for our "unit tests" (e.g., those marked with IsUnitTest: true in resource.TestCase) as they don't run against a real server but do use the Terraform acceptance testing logic.
I think we can likely remove most (if not all) tests of this form as a followup / cleanup action since they don't provide much actual value vs. acceptance tests. E.g., they are a very bare minimum check that a plan / apply can succeed against a completely mocked out server that does not actually return data in the correct shape.
36fa76e to
c21b279
Compare
Bumps [crazy-max/ghaction-import-gpg](https://github.com/crazy-max/ghaction-import-gpg) from 6.3.0 to 7.0.0. - [Release notes](https://github.com/crazy-max/ghaction-import-gpg/releases) - [Commits](crazy-max/ghaction-import-gpg@e89d409...2dc316d) --- updated-dependencies: - dependency-name: crazy-max/ghaction-import-gpg dependency-version: 7.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> all: create a Mux terraform for Terraform SDKv2 + plugin framework Start migrating to the Terraform plugin framework by [serving the provider][1] using both the existing SDKv2 and the framework served via [a mux][2]. This patch contains the basic mux server and enough changes to get the acceptance tests passing, but doesn't actually implement any resources or data sources. Because Terraform checks that the schema is consistent across the muxed providers, our old strategy of deleting the schema for the tests doesn't work; instead, we set an API key via environment variable. The `t.Setenv` helper can't be used in parallel, so we have to switch parallel tests to serial. [1]: https://developer.hashicorp.com/terraform/plugin/framework/migrating/providers#serving-the-provider [2]: https://developer.hashicorp.com/terraform/plugin/framework/migrating/mux Updates tailscale/corp#37220 Signed-off-by: Alex Chan <alexc@tailscale.com>
c21b279 to
4f312c4
Compare
|
I've addressed all the nits and broken the framework code into a new file. |
Start migrating to the Terraform plugin framework by serving the provider using both the existing SDKv2 and the framework served via a mux. This patch contains the basic mux server and enough changes to get the acceptance tests passing, but doesn't actually implement any resources or data sources.
Updates tailscale/corp#37220