Skip to content

Commit

Permalink
Remove some modules (#2473)
Browse files Browse the repository at this point in the history
This removes three unnecessary modules:
* pf/go.mod
* x/muxer/go.mod
* testing/go.mod

And three unnecessary test modules:
* pf/tests/go.mod
* pkg/tests/go.mod
* x/muxer/tests/go.mod

This is intended to be merged with #2477 and #2480, which combine to
make this a no-op for existing consumers.

Refs #1445.
  • Loading branch information
blampe authored Oct 15, 2024
1 parent 678d0fd commit 4e35e56
Show file tree
Hide file tree
Showing 117 changed files with 326 additions and 11,341 deletions.
5 changes: 5 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ issues:
- pkg/tf2pulumi/internal/config
- pkg/tf2pulumi/internal/configs
- pkg/vendored
# TODO(https://github.com/pulumi/pulumi-terraform-bridge/issues/2474)
- pf/tests
- pkg/tests
- testing
- x/muxer/tests
linters-settings:
gci:
sections:
Expand Down
6 changes: 0 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ test:: install_plugins
go build -o bin ./internal/testing/pulumi-terraform-bridge-test-provider
PULUMI_TERRAFORM_BRIDGE_TEST_PROVIDER=$(shell pwd)/bin/pulumi-terraform-bridge-test-provider \
go test -v -count=1 -coverprofile="coverage.txt" -coverpkg=./... -timeout 2h -parallel ${TESTPARALLELISM} ./...
cd testing && go test -v -count=1 -coverprofile="coverage.txt" -coverpkg=./... ./...
cd pkg/tests && go test -v -count=1 -coverprofile="coverage.txt" -coverpkg=./... -timeout 2h -parallel ${TESTPARALLELISM} ./...

# Unit and integration tests for the muxer.
cd x/muxer && go test -v -count=1 ./...
cd x/muxer/tests && go test -v -count=1 ./...

# Run tests while accepting current output as expected output "golden"
# tests. In case where system behavior changes intentionally this can
Expand Down
12 changes: 6 additions & 6 deletions docs/upgrade-sdk-to-mux.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Framework](https://github.com/hashicorp/terraform-plugin-sdk?tab=readme-ov-file)

1. Find the tfgen binary `main` that calls `tfgen.Main` from
`github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen` and update it to call
`tfgen.MainWithMuxer` from `github.com/pulumi/pulumi-terraform-bridge/pf/tfgen`.
`tfgen.MainWithMuxer` from `github.com/pulumi/pulumi-terraform-bridge/v3/pf/tfgen`.

Note that the extra version parameter is removed from `tfgen.Main`, so this code:

Expand All @@ -29,7 +29,7 @@ Framework](https://github.com/hashicorp/terraform-plugin-sdk?tab=readme-ov-file)
Becomes:

``` go
import "github.com/pulumi/pulumi-terraform-bridge/pf/tfgen"
import "github.com/pulumi/pulumi-terraform-bridge/v3/pf/tfgen"

...

Expand All @@ -39,7 +39,7 @@ Framework](https://github.com/hashicorp/terraform-plugin-sdk?tab=readme-ov-file)
1. Find the provider binary `main` that calls
[`"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge".Main`](https://pkg.go.dev/github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge#Main)
and update it to
[`"github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge".MainWithMuxer`](https://pkg.go.dev/github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge#MainWithMuxer).
[`"github.com/pulumi/pulumi-terraform-bridge/v3/pf/tfbridge".MainWithMuxer`](https://pkg.go.dev/github.com/pulumi/pulumi-terraform-bridge/v3/pf/tfbridge#MainWithMuxer).

Note the signature changes: version parameter is removed, and `Context` is now required, so this
code:
Expand All @@ -55,7 +55,7 @@ Framework](https://github.com/hashicorp/terraform-plugin-sdk?tab=readme-ov-file)
Becomes:

```go
import "github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge"
import "github.com/pulumi/pulumi-terraform-bridge/v3/pf/tfbridge"
...
Expand All @@ -67,7 +67,7 @@ Framework](https://github.com/hashicorp/terraform-plugin-sdk?tab=readme-ov-file)
(typically in `provider/resources.go`), changing the embedded
`"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge".ProviderInfo.P` to the
result of calling
[`"github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge".MuxShimWithPF`](https://pkg.go.dev/github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge#MuxShimWithPF).
[`"github.com/pulumi/pulumi-terraform-bridge/v3/pf/tfbridge".MuxShimWithPF`](https://pkg.go.dev/github.com/pulumi/pulumi-terraform-bridge/v3/pf/tfbridge#MuxShimWithPF).

This function combines the original SDK based provider with the new PF based provider, so this code:

Expand Down Expand Up @@ -106,7 +106,7 @@ Framework](https://github.com/hashicorp/terraform-plugin-sdk?tab=readme-ov-file)
```go
import (
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge"
pfbridge "github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge"
pfbridge "github.com/pulumi/pulumi-terraform-bridge/v3/pf/tfbridge"
shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2"
"github.com/${PROVIDER_ORG}/terraform-provider-${PROVIDER_NAME}"
Expand Down
6 changes: 3 additions & 3 deletions dynamic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ Let's go through each package in turn.
### `package main`

`package main` is responsible for launching a Pulumi provider and setting up the parameterize call. It does
this by calling [`pf/tfbridge.Main`](https://pkg.go.dev/github.com/pulumi/pulumi-terraform-bridge/[email protected]/tfbridge#Main), passing in an empty Terraform Plugin Framework provider (from
[`pf/proto.Empty()`](https://pkg.go.dev/github.com/pulumi/pulumi-terraform-bridge/[email protected]/proto#Empty)). [`pf/tfbridge.ProviderMetadata`](https://pkg.go.dev/github.com/pulumi/pulumi-terraform-bridge/[email protected]/tfbridge#ProviderMetadata) allows overriding the `Parameterize` and
this by calling [`pf/tfbridge.Main`](https://pkg.go.dev/github.com/pulumi/pulumi-terraform-bridge/v3/[email protected]/tfbridge#Main), passing in an empty Terraform Plugin Framework provider (from
[`pf/proto.Empty()`](https://pkg.go.dev/github.com/pulumi/pulumi-terraform-bridge/v3/[email protected]/proto#Empty)). [`pf/tfbridge.ProviderMetadata`](https://pkg.go.dev/github.com/pulumi/pulumi-terraform-bridge/v3/[email protected]/tfbridge#ProviderMetadata) allows overriding the `Parameterize` and
`GetSchema` call (and we override both).

When `Parameterize` is called, we launch the underlying Terraform provider via
`internal/shim/run.LocalProvider` or `internal/shim/run.NamedProvider` (downloading as necessary). Both
functions return a [`tfprotov6.ProviderServer`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-go/tfprotov6#ProviderServer) which is used to re-initialize the running provider via
[`pf/tfbridge.XParameterizeResetProvider`](https://pkg.go.dev/github.com/pulumi/pulumi-terraform-bridge/[email protected]/tfbridge#XParameterizeResetProvider).
[`pf/tfbridge.XParameterizeResetProvider`](https://pkg.go.dev/github.com/pulumi/pulumi-terraform-bridge/v3/[email protected]/tfbridge#XParameterizeResetProvider).

When `GetSchema` is called, it generates a schema from the currently equipped provider with
[`pkg/tfgen.GenerateSchemaWithOptions`](https://pkg.go.dev/github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen#GenerateSchemaWithOptions) and returns it. All type translation, documentation generation, etc
Expand Down
25 changes: 10 additions & 15 deletions dynamic/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@ replace (
github.com/hashicorp/terraform-plugin-sdk/v2 => github.com/pulumi/terraform-plugin-sdk/v2 v2.0.0-20240520223432-0c0bf0d65f10

github.com/opentofu/opentofu/shim => ./internal/shim
github.com/pulumi/pulumi-terraform-bridge/pf => ../pf
github.com/pulumi/pulumi-terraform-bridge/v3 => ../
)

require (
github.com/blang/semver v3.5.1+incompatible
github.com/hexops/autogold/v2 v2.2.1
github.com/opentofu/opentofu/shim v0.0.0-00010101000000-000000000000
github.com/pulumi/pulumi-terraform-bridge/pf v0.0.0-00010101000000-000000000000
github.com/pulumi/pulumi-terraform-bridge/v3 v3.92.0
github.com/stretchr/testify v1.9.0
google.golang.org/protobuf v1.34.0
google.golang.org/protobuf v1.34.2
)

require (
Expand All @@ -31,8 +29,7 @@ require (

require (
cloud.google.com/go v0.112.1 // indirect
cloud.google.com/go/compute v1.25.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/compute/metadata v0.3.0 // indirect
cloud.google.com/go/iam v1.1.6 // indirect
cloud.google.com/go/kms v1.15.7 // indirect
cloud.google.com/go/logging v1.9.0 // indirect
Expand Down Expand Up @@ -112,7 +109,7 @@ require (
github.com/gofrs/uuid v4.2.0+incompatible // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/golang/glog v1.2.0 // indirect
github.com/golang/glog v1.2.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
Expand All @@ -132,7 +129,7 @@ require (
github.com/hashicorp/go-getter v1.7.5 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.6.0 // indirect
github.com/hashicorp/go-plugin v1.6.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
Expand All @@ -144,8 +141,8 @@ require (
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/hcl/v2 v2.20.1 // indirect
github.com/hashicorp/hil v0.0.0-20190212132231-97b3a9cdfa93 // indirect
github.com/hashicorp/terraform-plugin-framework v1.7.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.23.0
github.com/hashicorp/terraform-plugin-framework v1.12.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.24.0
github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect
github.com/hashicorp/terraform-plugin-mux v0.16.0 // indirect
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
Expand Down Expand Up @@ -204,7 +201,6 @@ require (
github.com/pulumi/esc v0.10.0 // indirect
github.com/pulumi/inflector v0.1.1 // indirect
github.com/pulumi/pulumi-java/pkg v0.16.1 // indirect
github.com/pulumi/pulumi-terraform-bridge/x/muxer v0.0.10 // indirect
github.com/pulumi/pulumi-yaml v1.10.3 // indirect
github.com/pulumi/pulumi/pkg/v3 v3.136.1
github.com/pulumi/pulumi/sdk/v3 v3.136.1
Expand Down Expand Up @@ -250,7 +246,7 @@ require (
golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8 // indirect
golang.org/x/mod v0.18.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.22.0 // indirect
Expand All @@ -259,11 +255,10 @@ require (
golang.org/x/tools v0.22.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/api v0.169.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240311173647-c811ad7063a7 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240311173647-c811ad7063a7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240311173647-c811ad7063a7 // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect
google.golang.org/grpc v1.66.2 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/frand v1.4.2 // indirect
Expand Down
Loading

0 comments on commit 4e35e56

Please sign in to comment.