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

Fix shims #2511

Merged
merged 11 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Fixes a false positive for gofmt on Windows.
# For more details,see: https://github.com/golangci/golangci-lint/issues/580
*.go text eol=lf
*.go text eol=lf
**/vendor/** linguist-vendored
12 changes: 4 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (
github.com/hashicorp/terraform-plugin-mux v0.16.0
github.com/hashicorp/terraform-plugin-sdk v1.7.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0
github.com/hashicorp/terraform-provider-tls/shim v0.0.0-00010101000000-000000000000
github.com/hashicorp/terraform-provider-tls v1.2.1-0.20230117062332-afdd54107aba
github.com/hashicorp/terraform-svchost v0.1.1
github.com/hexops/autogold/v2 v2.2.1
github.com/hexops/valast v1.4.4
Expand All @@ -51,7 +51,7 @@ require (
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.9.0
github.com/teekennedy/goldmark-markdown v0.3.0
github.com/terraform-providers/terraform-provider-random/randomshim v0.0.0-00010101000000-000000000000
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will actual random provider build with this fine? It has its own dependency on this, and its own linker trick.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to change anything for the "real" random provider - it can continue to use the shim since it's not consumed as a library.

github.com/terraform-providers/terraform-provider-random v1.3.2-0.20231204135814-c6e90de46687
github.com/yuin/goldmark v1.7.4
github.com/zclconf/go-cty v1.14.2
golang.org/x/crypto v0.25.0
Expand Down Expand Up @@ -96,7 +96,6 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/hashicorp/terraform-provider-tls v0.0.0 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
Expand All @@ -111,7 +110,6 @@ require (
github.com/pulumi/appdash v0.0.0-20231130102222-75f619a67231 // indirect
github.com/pulumi/esc v0.10.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/terraform-providers/terraform-provider-random v1.3.2-0.20231204135814-c6e90de46687 // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect
Expand Down Expand Up @@ -261,8 +259,6 @@ require (

replace github.com/hashicorp/terraform-plugin-sdk/v2 => github.com/pulumi/terraform-plugin-sdk/v2 v2.0.0-20240520223432-0c0bf0d65f10

replace github.com/hashicorp/terraform-provider-tls => github.com/hashicorp/terraform-provider-tls v1.2.1-0.20230117062332-afdd54107aba
replace github.com/hashicorp/terraform-provider-tls => ./pkg/pf/tests/internal/tlsshim/vendor/github.com/hashicorp/terraform-provider-tls

replace github.com/hashicorp/terraform-provider-tls/shim => ./pkg/pf/tests/internal/tlsshim

replace github.com/terraform-providers/terraform-provider-random/randomshim => ./pkg/pf/tests/internal/randomshim
replace github.com/terraform-providers/terraform-provider-random => ./pkg/pf/tests/internal/randomshim/vendor/github.com/hashicorp/terraform-provider-random
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1682,8 +1682,6 @@ github.com/hashicorp/terraform-plugin-sdk v1.7.0/go.mod h1:OjgQmey5VxnPej/buEhe+
github.com/hashicorp/terraform-plugin-test v1.2.0/go.mod h1:QIJHYz8j+xJtdtLrFTlzQVC0ocr3rf/OjIpgZLK56Hs=
github.com/hashicorp/terraform-plugin-testing v1.5.1 h1:T4aQh9JAhmWo4+t1A7x+rnxAJHCDIYW9kXyo4sVO92c=
github.com/hashicorp/terraform-plugin-testing v1.5.1/go.mod h1:dg8clO6K59rZ8w9EshBmDp1CxTIPu3yA4iaDpX1h5u0=
github.com/hashicorp/terraform-provider-tls v1.2.1-0.20230117062332-afdd54107aba h1:xoUp/RqxaIf20SzMbRTbdM/ORPoJ6CBGuw9PoxyGWqk=
github.com/hashicorp/terraform-provider-tls v1.2.1-0.20230117062332-afdd54107aba/go.mod h1:TBjYP1eCMBy/8zMvovtWNHC9/HT/qaRNqN8HdxeIWaE=
github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI=
github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM=
github.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg=
Expand Down Expand Up @@ -2031,8 +2029,6 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/teekennedy/goldmark-markdown v0.3.0 h1:ik9/biVGCwGWFg8dQ3KVm2pQ/wiiG0whYiUcz9xH0W8=
github.com/teekennedy/goldmark-markdown v0.3.0/go.mod h1:kMhDz8La77A9UHvJGsxejd0QUflN9sS+QXCqnhmxmNo=
github.com/terraform-providers/terraform-provider-random v1.3.2-0.20231204135814-c6e90de46687 h1:4gT3jbJFnnGV2Liq4jziT7C4w/OOM+pkuwBGVDagRgc=
github.com/terraform-providers/terraform-provider-random v1.3.2-0.20231204135814-c6e90de46687/go.mod h1:nH2NdrX91QoiiaPJsTZ9vKoezUq5IgHJ8nijpD6lT5o=
github.com/texttheater/golang-levenshtein v1.0.1 h1:+cRNoVrfiwufQPhoMzB6N0Yf/Mqajr6t1lOv8GyGE2U=
github.com/texttheater/golang-levenshtein v1.0.1/go.mod h1:PYAKrbF5sAiq9wd+H82hs7gNaen0CplQ9uvm6+enD/8=
github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM=
Expand Down
3 changes: 1 addition & 2 deletions pkg/pf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ gen.testdata::
tidy::
go mod tidy
cd tests && go mod tidy
cd tests/internal/randomshim && go mod tidy
cd tests/internal/tlsshim && go mod tidy
cd dynamic && go mod tidy
cd tests/testdatagen/genrandom && go mod tidy

.PHONY: todos
4 changes: 2 additions & 2 deletions pkg/pf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Follow these steps to bridge a Terraform Provider to Pulumi.
[exposes](https://github.com/hashicorp/terraform-provider-random/blob/main/internal/provider/provider.go#L13) a `func
New() provider.Provider` call. Since this definition lives in an `internal` package it cannot easily be referenced in
an external Go project, but it is still possible to reference it using Go linker tricks. See
`tests/internal/randomshim/shim.go` for a full example.
[pulumi-random](https://github.com/pulumi/pulumi-random/tree/48c0b3014aeaa0cb95fd6419d631cb2555ce89ac/provider/shim) for a full example.

2. Populate a `ProviderInfo` struct, mapping Terraform resource names to Pulumi tokens. Replace `myprovider` with your
provider name.
Expand Down Expand Up @@ -137,7 +137,7 @@ to the Plugin Framework.

import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/terraform-providers/terraform-provider-tls/internal/provider"
"github.com/hashicorp/terraform-provider-tls/internal/provider"
)

func NewProvider() *schema.Provider {
Expand Down
38 changes: 0 additions & 38 deletions pkg/pf/tests/internal/randomshim/go.mod

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/pf/tests/internal/randomshim/shim.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package randomshim

import (
tfpf "github.com/hashicorp/terraform-plugin-framework/provider"
"github.com/terraform-providers/terraform-provider-random/internal/provider"
"github.com/terraform-providers/terraform-provider-random/provider"
)

func NewProvider() tfpf.Provider {
Expand Down
Loading
Loading