diff --git a/.golangci.yml b/.golangci.yml index 95305d3d6..1959f18ca 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -6,11 +6,14 @@ linters: enable: - errcheck - gofmt + - gci - gosec - govet - ineffassign - lll - - megacheck + - gosimple + - staticcheck + - unused - misspell - nakedret - nolintlint @@ -25,3 +28,10 @@ issues: - pkg/tf2pulumi/internal/addrs - pkg/tf2pulumi/internal/config - pkg/tf2pulumi/internal/configs +linters-settings: + gci: + sections: + - standard + - default + - prefix(github.com/pulumi/pulumi-terraform-bridge) + skip-generated: true diff --git a/Makefile b/Makefile index 2c2033535..77bdc6f62 100644 --- a/Makefile +++ b/Makefile @@ -13,9 +13,12 @@ build:: fmt:: @gofmt -w -s . -lint:: +lint: go run scripts/build.go lint +lint_fix: + go run scripts/build.go fix-lint + test:: @mkdir -p bin go build -o bin ./internal/testing/pulumi-terraform-bridge-test-provider diff --git a/dynamic/info.go b/dynamic/info.go index 1f1a24371..077c4fae0 100644 --- a/dynamic/info.go +++ b/dynamic/info.go @@ -21,11 +21,11 @@ import ( "strings" "github.com/opentofu/opentofu/shim/run" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" "github.com/pulumi/pulumi-terraform-bridge/pf/proto" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/tokens" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" ) func providerInfo(ctx context.Context, p run.Provider) tfbridge.ProviderInfo { diff --git a/dynamic/internal/shim/run/loader.go b/dynamic/internal/shim/run/loader.go index 7f96f4428..56ee6ad26 100644 --- a/dynamic/internal/shim/run/loader.go +++ b/dynamic/internal/shim/run/loader.go @@ -38,10 +38,10 @@ import ( v5shim "github.com/opentofu/opentofu/shim/protov5" v6shim "github.com/opentofu/opentofu/shim/protov6" tfaddr "github.com/opentofu/registry-address" - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" "github.com/pulumi/pulumi/sdk/v3/go/common/workspace" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" ) // envPluginCache allows users to override where we cache TF providers used by diff --git a/dynamic/internal/shim/run/loader_test.go b/dynamic/internal/shim/run/loader_test.go index 3f78b945f..0d8c2acae 100644 --- a/dynamic/internal/shim/run/loader_test.go +++ b/dynamic/internal/shim/run/loader_test.go @@ -20,7 +20,6 @@ import ( "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/dynamic/main.go b/dynamic/main.go index 5a9df76f6..7f8a691b2 100644 --- a/dynamic/main.go +++ b/dynamic/main.go @@ -27,12 +27,11 @@ import ( "github.com/pulumi/pulumi/sdk/v3/go/common/diag/colors" "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" + "github.com/pulumi/pulumi-terraform-bridge/dynamic/version" "github.com/pulumi/pulumi-terraform-bridge/pf/proto" pfbridge "github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen" - - "github.com/pulumi/pulumi-terraform-bridge/dynamic/version" ) func initialSetup() (tfbridge.ProviderInfo, pfbridge.ProviderMetadata, func() error) { diff --git a/dynamic/provider_test.go b/dynamic/provider_test.go index 0e7428248..0e73c45d4 100644 --- a/dynamic/provider_test.go +++ b/dynamic/provider_test.go @@ -14,18 +14,18 @@ import ( "testing" "github.com/hexops/autogold/v2" - helper "github.com/pulumi/pulumi-terraform-bridge/dynamic/internal/testing" - pfbridge "github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge" "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/structpb" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" + helper "github.com/pulumi/pulumi-terraform-bridge/dynamic/internal/testing" + pfbridge "github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge" ) // globalTempDir is a temporary directory scoped to the entire test cycle. diff --git a/internal/testprovider_invalid_schema/resources.go b/internal/testprovider_invalid_schema/resources.go index 341dfcfa9..b5aa25f92 100644 --- a/internal/testprovider_invalid_schema/resources.go +++ b/internal/testprovider_invalid_schema/resources.go @@ -15,10 +15,11 @@ package tpinvschema import ( + "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" sdkv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" ) func ProviderInfo() tfbridge.ProviderInfo { diff --git a/internal/testprovider_sdkv2/resources.go b/internal/testprovider_sdkv2/resources.go index eee9a6715..f2d61c92c 100644 --- a/internal/testprovider_sdkv2/resources.go +++ b/internal/testprovider_sdkv2/resources.go @@ -15,10 +15,11 @@ package tpsdkv2 import ( + "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" sdkv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" ) func ProviderInfo() tfbridge.ProviderInfo { diff --git a/pf/internal/check/check_test.go b/pf/internal/check/check_test.go index 8f4d781e0..43a6ca1f2 100644 --- a/pf/internal/check/check_test.go +++ b/pf/internal/check/check_test.go @@ -24,15 +24,14 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" sdkschema "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/stretchr/testify/assert" - - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" - sdkv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" "github.com/pulumi/pulumi/sdk/v3/go/common/diag" "github.com/pulumi/pulumi/sdk/v3/go/common/diag/colors" property "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/stretchr/testify/assert" pfbridge "github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" + sdkv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" ) func TestMissingIDProperty(t *testing.T) { diff --git a/pf/internal/check/not_supported_test.go b/pf/internal/check/not_supported_test.go index a6c6966a9..2acefc1da 100644 --- a/pf/internal/check/not_supported_test.go +++ b/pf/internal/check/not_supported_test.go @@ -18,10 +18,9 @@ import ( "bytes" "testing" + "github.com/pulumi/pulumi/sdk/v3/go/common/diag" "github.com/pulumi/pulumi/sdk/v3/go/common/diag/colors" "github.com/stretchr/testify/require" - - "github.com/pulumi/pulumi/sdk/v3/go/common/diag" ) func TestZeroRecognizer(t *testing.T) { diff --git a/pf/internal/defaults/defaults.go b/pf/internal/defaults/defaults.go index c4073e13a..d4419f05a 100644 --- a/pf/internal/defaults/defaults.go +++ b/pf/internal/defaults/defaults.go @@ -21,7 +21,6 @@ import ( "strconv" "github.com/hashicorp/terraform-plugin-log/tflog" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" diff --git a/pf/internal/defaults/defaults_test.go b/pf/internal/defaults/defaults_test.go index c900e389d..f5667e0cb 100644 --- a/pf/internal/defaults/defaults_test.go +++ b/pf/internal/defaults/defaults_test.go @@ -18,11 +18,10 @@ import ( "context" "testing" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/schema" diff --git a/pf/internal/muxer/muxer.go b/pf/internal/muxer/muxer.go index 42fdb0c79..d7ac28ede 100644 --- a/pf/internal/muxer/muxer.go +++ b/pf/internal/muxer/muxer.go @@ -15,20 +15,20 @@ package muxer import ( + "context" "fmt" "strings" - "context" - "github.com/hashicorp/go-multierror" "github.com/hashicorp/terraform-plugin-framework/provider" + "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + "github.com/pulumi/pulumi-terraform-bridge/pf" "github.com/pulumi/pulumi-terraform-bridge/pf/internal/schemashim" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/x/muxer" - "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) func SchemaOnlyPluginFrameworkProvider(ctx context.Context, provider provider.Provider) shim.Provider { diff --git a/pf/internal/muxer/union.go b/pf/internal/muxer/union.go index d24b44ce4..cb483986c 100644 --- a/pf/internal/muxer/union.go +++ b/pf/internal/muxer/union.go @@ -18,8 +18,9 @@ import ( "fmt" "sort" - shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) type unionMap[T any] struct { diff --git a/pf/internal/pfutils/attr.go b/pf/internal/pfutils/attr.go index 3607e98a1..cf0d48e06 100644 --- a/pf/internal/pfutils/attr.go +++ b/pf/internal/pfutils/attr.go @@ -21,7 +21,6 @@ import ( dschema "github.com/hashicorp/terraform-plugin-framework/datasource/schema" pschema "github.com/hashicorp/terraform-plugin-framework/provider/schema" rschema "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-go/tftypes" ) diff --git a/pf/internal/pfutils/block.go b/pf/internal/pfutils/block.go index 07fda61d7..ee5510ba2 100644 --- a/pf/internal/pfutils/block.go +++ b/pf/internal/pfutils/block.go @@ -20,12 +20,11 @@ import ( "strconv" "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" - dschema "github.com/hashicorp/terraform-plugin-framework/datasource/schema" pschema "github.com/hashicorp/terraform-plugin-framework/provider/schema" rschema "github.com/hashicorp/terraform-plugin-framework/resource/schema" "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) // Block type works around not being able to link to fwschema.Block from diff --git a/pf/internal/pfutils/common.go b/pf/internal/pfutils/common.go index d4dcd8396..3aa5d5a0a 100644 --- a/pf/internal/pfutils/common.go +++ b/pf/internal/pfutils/common.go @@ -21,6 +21,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/provider" + "github.com/pulumi/pulumi-terraform-bridge/pf/internal/runtypes" ) diff --git a/pf/internal/pfutils/datasources.go b/pf/internal/pfutils/datasources.go index 5409432bb..ed9b980b4 100644 --- a/pf/internal/pfutils/datasources.go +++ b/pf/internal/pfutils/datasources.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/provider" + "github.com/pulumi/pulumi-terraform-bridge/pf/internal/runtypes" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) diff --git a/pf/internal/pfutils/proposed_new.go b/pf/internal/pfutils/proposed_new.go index 4c51b68e9..f4e297e25 100644 --- a/pf/internal/pfutils/proposed_new.go +++ b/pf/internal/pfutils/proposed_new.go @@ -18,10 +18,10 @@ import ( "context" "fmt" - "github.com/pulumi/pulumi-terraform-bridge/pf/internal/runtypes" + "github.com/hashicorp/terraform-plugin-go/tftypes" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" - "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/pulumi/pulumi-terraform-bridge/pf/internal/runtypes" ) // Computes the ProposedNewState from priorState and config. diff --git a/pf/internal/pfutils/proposed_new_test.go b/pf/internal/pfutils/proposed_new_test.go index f0401cc61..8c8827662 100644 --- a/pf/internal/pfutils/proposed_new_test.go +++ b/pf/internal/pfutils/proposed_new_test.go @@ -18,15 +18,14 @@ import ( "context" "testing" - "github.com/pulumi/pulumi-terraform-bridge/pf/internal/runtypes" - shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" - "github.com/stretchr/testify/require" - "github.com/hashicorp/terraform-plugin-framework/resource/schema" rschema "github.com/hashicorp/terraform-plugin-framework/resource/schema" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" - "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/stretchr/testify/require" + + "github.com/pulumi/pulumi-terraform-bridge/pf/internal/runtypes" + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) type testcase struct { diff --git a/pf/internal/pfutils/resources.go b/pf/internal/pfutils/resources.go index a15c4b30e..77536798b 100644 --- a/pf/internal/pfutils/resources.go +++ b/pf/internal/pfutils/resources.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/provider" "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/pulumi/pulumi-terraform-bridge/pf/internal/runtypes" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) diff --git a/pf/internal/plugin/provider_context.go b/pf/internal/plugin/provider_context.go index 5ff8f75a3..6293dfa72 100644 --- a/pf/internal/plugin/provider_context.go +++ b/pf/internal/plugin/provider_context.go @@ -18,10 +18,9 @@ import ( "context" "io" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" p "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" - - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" "github.com/pulumi/pulumi/sdk/v3/go/common/workspace" ) diff --git a/pf/internal/plugin/provider_server.go b/pf/internal/plugin/provider_server.go index 1475097e1..2fe807fe4 100644 --- a/pf/internal/plugin/provider_server.go +++ b/pf/internal/plugin/provider_server.go @@ -21,15 +21,14 @@ import ( "github.com/blang/semver" pbempty "github.com/golang/protobuf/ptypes/empty" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi/sdk/v3/go/common/resource/config" "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" pl "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" ) diff --git a/pf/internal/schemashim/attr_schema.go b/pf/internal/schemashim/attr_schema.go index 7cf7076fd..613f988a8 100644 --- a/pf/internal/schemashim/attr_schema.go +++ b/pf/internal/schemashim/attr_schema.go @@ -15,12 +15,11 @@ package schemashim import ( - bridge "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" - pfattr "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" "github.com/pulumi/pulumi-terraform-bridge/pf/internal/pfutils" + bridge "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) diff --git a/pf/internal/schemashim/block_schema.go b/pf/internal/schemashim/block_schema.go index 380bc55aa..88797bca1 100644 --- a/pf/internal/schemashim/block_schema.go +++ b/pf/internal/schemashim/block_schema.go @@ -17,12 +17,11 @@ package schemashim import ( "fmt" - bridge "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" - "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" "github.com/pulumi/pulumi-terraform-bridge/pf/internal/pfutils" + bridge "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) diff --git a/pf/internal/schemashim/object_pseudoresource.go b/pf/internal/schemashim/object_pseudoresource.go index f11659334..6cbbd78ba 100644 --- a/pf/internal/schemashim/object_pseudoresource.go +++ b/pf/internal/schemashim/object_pseudoresource.go @@ -21,12 +21,12 @@ import ( "strconv" "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" "github.com/pulumi/pulumi-terraform-bridge/pf/internal/pfutils" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) // An Object type that masquerades as a Resource. This is a workaround to reusing tfgen code for generating schemas, diff --git a/pf/internal/schemashim/provider.go b/pf/internal/schemashim/provider.go index 27d8e3261..6ace43016 100644 --- a/pf/internal/schemashim/provider.go +++ b/pf/internal/schemashim/provider.go @@ -18,15 +18,15 @@ import ( "context" "fmt" - shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" - pfprovider "github.com/hashicorp/terraform-plugin-framework/provider" "github.com/hashicorp/terraform-plugin-framework/providerserver" "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/pulumi/pulumi-terraform-bridge/pf" "github.com/pulumi/pulumi-terraform-bridge/pf/internal/pfutils" "github.com/pulumi/pulumi-terraform-bridge/pf/internal/runtypes" + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) var _ = pf.ShimProvider(&SchemaOnlyProvider{}) diff --git a/pf/internal/schemashim/schemashim.go b/pf/internal/schemashim/schemashim.go index 2242c3f33..515ca0700 100644 --- a/pf/internal/schemashim/schemashim.go +++ b/pf/internal/schemashim/schemashim.go @@ -18,6 +18,7 @@ import ( "context" pfprovider "github.com/hashicorp/terraform-plugin-framework/provider" + "github.com/pulumi/pulumi-terraform-bridge/pf/internal/pfutils" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) diff --git a/pf/internal/schemashim/type_schema.go b/pf/internal/schemashim/type_schema.go index e4fc5ab05..0785f99e7 100644 --- a/pf/internal/schemashim/type_schema.go +++ b/pf/internal/schemashim/type_schema.go @@ -18,10 +18,11 @@ import ( pfattr "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + "github.com/pulumi/pulumi-terraform-bridge/pf/internal/pfutils" bridge "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) type typeSchema struct { diff --git a/pf/proto/attribute.go b/pf/proto/attribute.go index dd2d06dad..99a5946a5 100644 --- a/pf/proto/attribute.go +++ b/pf/proto/attribute.go @@ -16,10 +16,9 @@ package proto import ( "github.com/hashicorp/terraform-plugin-go/tfprotov6" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" - - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) var _ = shim.Schema(attribute{}) diff --git a/pf/proto/block.go b/pf/proto/block.go index 8c219a5b5..45f919a04 100644 --- a/pf/proto/block.go +++ b/pf/proto/block.go @@ -18,9 +18,9 @@ import ( "fmt" "github.com/hashicorp/terraform-plugin-go/tfprotov6" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) // Each conceptual block has three components: diff --git a/pf/proto/empty.go b/pf/proto/empty.go index e6dcec792..6d474ad67 100644 --- a/pf/proto/empty.go +++ b/pf/proto/empty.go @@ -18,6 +18,7 @@ import ( "context" "github.com/hashicorp/terraform-plugin-go/tfprotov6" + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) diff --git a/pf/proto/object.go b/pf/proto/object.go index 2b9f0ae6c..c1550e6da 100644 --- a/pf/proto/object.go +++ b/pf/proto/object.go @@ -16,9 +16,9 @@ package proto import ( "github.com/hashicorp/terraform-plugin-go/tfprotov6" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) var ( diff --git a/pf/proto/protov6.go b/pf/proto/protov6.go index 49edf4cff..30c2c99ac 100644 --- a/pf/proto/protov6.go +++ b/pf/proto/protov6.go @@ -26,6 +26,7 @@ import ( "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/pulumi/pulumi-terraform-bridge/pf" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" diff --git a/pf/proto/resource.go b/pf/proto/resource.go index 58a2d4ee7..33c4fd056 100644 --- a/pf/proto/resource.go +++ b/pf/proto/resource.go @@ -16,9 +16,9 @@ package proto import ( "github.com/hashicorp/terraform-plugin-go/tfprotov6" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) var ( diff --git a/pf/proto/runtypes.go b/pf/proto/runtypes.go index d83c18b4d..439956ba3 100644 --- a/pf/proto/runtypes.go +++ b/pf/proto/runtypes.go @@ -19,7 +19,6 @@ import ( "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" "github.com/pulumi/pulumi-terraform-bridge/pf/internal/runtypes" diff --git a/pf/proto/schema.go b/pf/proto/schema.go index 427e8b58f..8e49afa4c 100644 --- a/pf/proto/schema.go +++ b/pf/proto/schema.go @@ -15,8 +15,9 @@ package proto import ( - shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) // pseudoResource represents a type that must pretent to be a [shim.Resource], but does not represent a resource. diff --git a/pf/tfbridge/detect_check_failures_test.go b/pf/tfbridge/detect_check_failures_test.go index 824ad09b1..5bdff0780 100644 --- a/pf/tfbridge/detect_check_failures_test.go +++ b/pf/tfbridge/detect_check_failures_test.go @@ -20,9 +20,8 @@ import ( "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/stretchr/testify/assert" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/stretchr/testify/assert" ) func TestDetectCheckFailures(t *testing.T) { diff --git a/pf/tfbridge/extend.go b/pf/tfbridge/extend.go index b0a839a70..6d69b245c 100644 --- a/pf/tfbridge/extend.go +++ b/pf/tfbridge/extend.go @@ -18,6 +18,7 @@ import ( "context" pfprovider "github.com/hashicorp/terraform-plugin-framework/provider" + "github.com/pulumi/pulumi-terraform-bridge/pf/internal/muxer" "github.com/pulumi/pulumi-terraform-bridge/pf/internal/schemashim" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" diff --git a/pf/tfbridge/naming.go b/pf/tfbridge/naming.go index 2a88c6a20..3b0005439 100644 --- a/pf/tfbridge/naming.go +++ b/pf/tfbridge/naming.go @@ -16,7 +16,6 @@ package tfbridge import ( "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" diff --git a/pf/tfbridge/provider.go b/pf/tfbridge/provider.go index df81c47d2..659e64326 100644 --- a/pf/tfbridge/provider.go +++ b/pf/tfbridge/provider.go @@ -19,16 +19,13 @@ import ( "fmt" "github.com/blang/semver" - pfprovider "github.com/hashicorp/terraform-plugin-framework/provider" "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/pulumi/pulumi/sdk/v3/go/common/apitype" "github.com/pulumi/pulumi/sdk/v3/go/common/diag" "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" - "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" "github.com/pulumi/pulumi/sdk/v3/go/common/workspace" diff --git a/pf/tfbridge/provider_check.go b/pf/tfbridge/provider_check.go index 95a9274af..3f83e6ed5 100644 --- a/pf/tfbridge/provider_check.go +++ b/pf/tfbridge/provider_check.go @@ -20,11 +20,12 @@ import ( "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" + "github.com/pulumi/pulumi-terraform-bridge/pf/internal/defaults" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/convert" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" ) // Check validates the given resource inputs from the user program and computes checked inputs that fill out default diff --git a/pf/tfbridge/provider_checkconfig.go b/pf/tfbridge/provider_checkconfig.go index 40101acd8..83333d92e 100644 --- a/pf/tfbridge/provider_checkconfig.go +++ b/pf/tfbridge/provider_checkconfig.go @@ -21,14 +21,14 @@ import ( "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/opentracing/opentracing-go" + rprovider "github.com/pulumi/pulumi/pkg/v3/resource/provider" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" "github.com/pulumi/pulumi-terraform-bridge/pf/internal/defaults" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/convert" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" - rprovider "github.com/pulumi/pulumi/pkg/v3/resource/provider" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" ) func makeFailuresFromCheckErr(err tfbridge.CheckFailureError) []plugin.CheckFailure { diff --git a/pf/tfbridge/provider_configure.go b/pf/tfbridge/provider_configure.go index 41a396229..0cdab1aa4 100644 --- a/pf/tfbridge/provider_configure.go +++ b/pf/tfbridge/provider_configure.go @@ -20,12 +20,11 @@ import ( "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/opentracing/opentracing-go" - - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" - shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/convert" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) // This function iterates over the diagnostics and replaces the names of tf config properties diff --git a/pf/tfbridge/provider_create.go b/pf/tfbridge/provider_create.go index 4a680dc7f..f373b5f90 100644 --- a/pf/tfbridge/provider_create.go +++ b/pf/tfbridge/provider_create.go @@ -19,7 +19,6 @@ import ( "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/convert" diff --git a/pf/tfbridge/provider_datasources.go b/pf/tfbridge/provider_datasources.go index 8b87a4181..f56bd7f40 100644 --- a/pf/tfbridge/provider_datasources.go +++ b/pf/tfbridge/provider_datasources.go @@ -18,7 +18,6 @@ import ( "context" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" "github.com/pulumi/pulumi-terraform-bridge/pf/internal/runtypes" diff --git a/pf/tfbridge/provider_delete.go b/pf/tfbridge/provider_delete.go index 6a9224e1d..f288f22cb 100644 --- a/pf/tfbridge/provider_delete.go +++ b/pf/tfbridge/provider_delete.go @@ -19,7 +19,6 @@ import ( "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/convert" diff --git a/pf/tfbridge/provider_diff.go b/pf/tfbridge/provider_diff.go index 7dc9ac180..899e17efe 100644 --- a/pf/tfbridge/provider_diff.go +++ b/pf/tfbridge/provider_diff.go @@ -20,7 +20,6 @@ import ( "sort" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" diff --git a/pf/tfbridge/provider_diff_test.go b/pf/tfbridge/provider_diff_test.go index 064838821..b9a029d29 100644 --- a/pf/tfbridge/provider_diff_test.go +++ b/pf/tfbridge/provider_diff_test.go @@ -18,9 +18,8 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/stretchr/testify/require" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/stretchr/testify/require" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/schema" diff --git a/pf/tfbridge/provider_diffconfig.go b/pf/tfbridge/provider_diffconfig.go index 86be3b68b..c0bb227a9 100644 --- a/pf/tfbridge/provider_diffconfig.go +++ b/pf/tfbridge/provider_diffconfig.go @@ -17,9 +17,10 @@ package tfbridge import ( "context" - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" + + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" ) // DiffConfig checks what impacts a hypothetical change to this provider's configuration will have diff --git a/pf/tfbridge/provider_invoke.go b/pf/tfbridge/provider_invoke.go index 6280fefdb..56f653890 100644 --- a/pf/tfbridge/provider_invoke.go +++ b/pf/tfbridge/provider_invoke.go @@ -22,13 +22,13 @@ import ( "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-go/tftypes" "github.com/hashicorp/terraform-plugin-log/tflog" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" + "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" "github.com/pulumi/pulumi-terraform-bridge/pf/internal/defaults" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/convert" "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/propertyvalue" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" - "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" ) // Invoke dynamically executes a built-in function in the provider. diff --git a/pf/tfbridge/provider_plan.go b/pf/tfbridge/provider_plan.go index 755ca0035..1ea738425 100644 --- a/pf/tfbridge/provider_plan.go +++ b/pf/tfbridge/provider_plan.go @@ -21,6 +21,7 @@ import ( "github.com/hashicorp/go-multierror" "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/pulumi/pulumi-terraform-bridge/pf/internal/pfutils" "github.com/pulumi/pulumi-terraform-bridge/pf/internal/runtypes" ) diff --git a/pf/tfbridge/provider_read.go b/pf/tfbridge/provider_read.go index 5efd136f1..82efc239f 100644 --- a/pf/tfbridge/provider_read.go +++ b/pf/tfbridge/provider_read.go @@ -19,7 +19,6 @@ import ( "fmt" "github.com/hashicorp/terraform-plugin-go/tfprotov6" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" diff --git a/pf/tfbridge/provider_test.go b/pf/tfbridge/provider_test.go index e6ca63fe6..d67d142c6 100644 --- a/pf/tfbridge/provider_test.go +++ b/pf/tfbridge/provider_test.go @@ -17,9 +17,8 @@ package tfbridge import ( "testing" - "github.com/stretchr/testify/assert" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/stretchr/testify/assert" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" ) diff --git a/pf/tfbridge/provider_update.go b/pf/tfbridge/provider_update.go index f0f797db0..ea69a3290 100644 --- a/pf/tfbridge/provider_update.go +++ b/pf/tfbridge/provider_update.go @@ -20,7 +20,6 @@ import ( "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/convert" diff --git a/pf/tfbridge/resource_state.go b/pf/tfbridge/resource_state.go index 08ba02d34..a36261683 100644 --- a/pf/tfbridge/resource_state.go +++ b/pf/tfbridge/resource_state.go @@ -23,7 +23,6 @@ import ( "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/convert" diff --git a/pf/tfbridge/serve.go b/pf/tfbridge/serve.go index 5f95c02b2..d9c888e7b 100644 --- a/pf/tfbridge/serve.go +++ b/pf/tfbridge/serve.go @@ -16,10 +16,11 @@ package tfbridge import ( "context" + rprovider "github.com/pulumi/pulumi/pkg/v3/resource/provider" + pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" - pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go" ) func serve(ctx context.Context, pkg string, prov tfbridge.ProviderInfo, meta ProviderMetadata) error { diff --git a/pf/tfbridge/tests/provider_test.go b/pf/tfbridge/tests/provider_test.go index 1da026557..a6d942574 100644 --- a/pf/tfbridge/tests/provider_test.go +++ b/pf/tfbridge/tests/provider_test.go @@ -8,15 +8,15 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/pulumi/providertest/replay" + "github.com/pulumi/pulumi/sdk/v3/go/common/diag" + "github.com/pulumi/pulumi/sdk/v3/go/common/diag/colors" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go" - "github.com/pulumi/providertest/replay" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen" shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" - "github.com/pulumi/pulumi/sdk/v3/go/common/diag" - "github.com/pulumi/pulumi/sdk/v3/go/common/diag/colors" ) // Demonstrating the use of the newTestProvider helper. diff --git a/pf/tfgen/tfgen_test.go b/pf/tfgen/tfgen_test.go index 70f43fb64..898706d69 100644 --- a/pf/tfgen/tfgen_test.go +++ b/pf/tfgen/tfgen_test.go @@ -16,20 +16,20 @@ package tfgen import ( "context" + "encoding/json" "testing" - pulumiSchema "github.com/pulumi/pulumi/pkg/v3/codegen/schema" - - "encoding/json" "github.com/hashicorp/terraform-plugin-framework-validators/listvalidator" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/provider" "github.com/hashicorp/terraform-plugin-framework/provider/schema" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/schema/validator" + pulumiSchema "github.com/pulumi/pulumi/pkg/v3/codegen/schema" + "github.com/stretchr/testify/require" + pftfbridge "github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" - "github.com/stretchr/testify/require" ) // Regressing an issue with AWS provider not recognizing that assume_role config setting is singular via diff --git a/pkg/convert/bool.go b/pkg/convert/bool.go index 3490e7650..b1a5aa2de 100644 --- a/pkg/convert/bool.go +++ b/pkg/convert/bool.go @@ -18,7 +18,6 @@ import ( "fmt" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" ) diff --git a/pkg/convert/convert.go b/pkg/convert/convert.go index b3303b196..934a3fdce 100644 --- a/pkg/convert/convert.go +++ b/pkg/convert/convert.go @@ -24,12 +24,11 @@ import ( "github.com/hashicorp/terraform-plugin-go/tfprotov6" "github.com/hashicorp/terraform-plugin-go/tftypes" - - "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/propertyvalue" "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" + "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/propertyvalue" ) // An alias to assist marking Terraform-level property names (see for example AttributeTypes in tftypes.Object). Pulumi diff --git a/pkg/convert/convert_test.go b/pkg/convert/convert_test.go index e0442a1d2..d14faad1a 100644 --- a/pkg/convert/convert_test.go +++ b/pkg/convert/convert_test.go @@ -22,10 +22,9 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" ) type convertTurnaroundTestCase struct { diff --git a/pkg/convert/encoding_test.go b/pkg/convert/encoding_test.go index adbabc355..65bfd2053 100644 --- a/pkg/convert/encoding_test.go +++ b/pkg/convert/encoding_test.go @@ -19,12 +19,10 @@ import ( "fmt" "testing" - "github.com/hexops/autogold/v2" - "github.com/stretchr/testify/require" - "github.com/hashicorp/terraform-plugin-go/tftypes" - + "github.com/hexops/autogold/v2" "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/stretchr/testify/require" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" diff --git a/pkg/convert/flattened.go b/pkg/convert/flattened.go index d1138e36e..2fe8215f4 100644 --- a/pkg/convert/flattened.go +++ b/pkg/convert/flattened.go @@ -16,8 +16,8 @@ package convert import ( "fmt" - "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/hashicorp/terraform-plugin-go/tftypes" "github.com/pulumi/pulumi/sdk/v3/go/common/resource" ) diff --git a/pkg/convert/flattened_test.go b/pkg/convert/flattened_test.go index 97ab1c794..6e6fafc08 100644 --- a/pkg/convert/flattened_test.go +++ b/pkg/convert/flattened_test.go @@ -17,15 +17,15 @@ package convert import ( "testing" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/hashicorp/terraform-plugin-go/tftypes" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" shimschema "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/schema" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/walk" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" ) func TestFlattenedEncoder(t *testing.T) { diff --git a/pkg/convert/infer_object.go b/pkg/convert/infer_object.go index 39071fb56..c4a75a298 100644 --- a/pkg/convert/infer_object.go +++ b/pkg/convert/infer_object.go @@ -16,8 +16,9 @@ package convert import ( "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) type InferObjectTypeOptions struct{} diff --git a/pkg/convert/list.go b/pkg/convert/list.go index cea480c68..fd63a64ea 100644 --- a/pkg/convert/list.go +++ b/pkg/convert/list.go @@ -18,7 +18,6 @@ import ( "fmt" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" ) diff --git a/pkg/convert/map.go b/pkg/convert/map.go index f84a9b8cd..830863417 100644 --- a/pkg/convert/map.go +++ b/pkg/convert/map.go @@ -18,7 +18,6 @@ import ( "fmt" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" ) diff --git a/pkg/convert/number.go b/pkg/convert/number.go index 00aa1a3d0..dc4e155a2 100644 --- a/pkg/convert/number.go +++ b/pkg/convert/number.go @@ -19,7 +19,6 @@ import ( "math/big" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" ) diff --git a/pkg/convert/object.go b/pkg/convert/object.go index be5cfe5a5..e90fcb995 100644 --- a/pkg/convert/object.go +++ b/pkg/convert/object.go @@ -18,7 +18,6 @@ import ( "fmt" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" ) diff --git a/pkg/convert/object_test.go b/pkg/convert/object_test.go index 8bd0800a3..36ccc6e0d 100644 --- a/pkg/convert/object_test.go +++ b/pkg/convert/object_test.go @@ -18,9 +18,8 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/stretchr/testify/require" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/stretchr/testify/require" ) // When PropertyMap is missing an entry, do not assume that the result is null but instead call the diff --git a/pkg/convert/schema_context.go b/pkg/convert/schema_context.go index 933041e2a..53f5df252 100644 --- a/pkg/convert/schema_context.go +++ b/pkg/convert/schema_context.go @@ -18,11 +18,12 @@ import ( "fmt" "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/walk" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) type schemaMapContext struct { diff --git a/pkg/convert/secret.go b/pkg/convert/secret.go index 3e37125a4..a04424421 100644 --- a/pkg/convert/secret.go +++ b/pkg/convert/secret.go @@ -16,7 +16,6 @@ package convert import ( "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" ) diff --git a/pkg/convert/secret_test.go b/pkg/convert/secret_test.go index c9629962f..2e279392a 100644 --- a/pkg/convert/secret_test.go +++ b/pkg/convert/secret_test.go @@ -20,9 +20,8 @@ import ( "github.com/hashicorp/terraform-plugin-go/tftypes" "github.com/hexops/autogold/v2" - "github.com/stretchr/testify/require" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/stretchr/testify/require" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" diff --git a/pkg/convert/set.go b/pkg/convert/set.go index 11fe026c4..d648e89df 100644 --- a/pkg/convert/set.go +++ b/pkg/convert/set.go @@ -18,7 +18,6 @@ import ( "fmt" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" ) diff --git a/pkg/convert/string.go b/pkg/convert/string.go index c00dc30be..97fe3fc16 100644 --- a/pkg/convert/string.go +++ b/pkg/convert/string.go @@ -19,7 +19,6 @@ import ( "strconv" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" ) diff --git a/pkg/convert/tuple.go b/pkg/convert/tuple.go index a367b5c7e..ff6df0887 100644 --- a/pkg/convert/tuple.go +++ b/pkg/convert/tuple.go @@ -20,7 +20,6 @@ import ( "strings" "github.com/hashicorp/terraform-plugin-go/tftypes" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" ) diff --git a/pkg/tf2pulumi/convert/convert.go b/pkg/tf2pulumi/convert/convert.go index f26b9e266..20e26e94d 100644 --- a/pkg/tf2pulumi/convert/convert.go +++ b/pkg/tf2pulumi/convert/convert.go @@ -20,10 +20,7 @@ import ( "os" "github.com/hashicorp/hcl/v2" - "github.com/spf13/afero" - hcl2java "github.com/pulumi/pulumi-java/pkg/codegen/java" - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tf2pulumi/il" hcl2yaml "github.com/pulumi/pulumi-yaml/pkg/pulumiyaml/codegen" hcl2dotnet "github.com/pulumi/pulumi/pkg/v3/codegen/dotnet" hcl2go "github.com/pulumi/pulumi/pkg/v3/codegen/go" @@ -33,6 +30,9 @@ import ( hcl2python "github.com/pulumi/pulumi/pkg/v3/codegen/python" "github.com/pulumi/pulumi/pkg/v3/codegen/schema" "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" + "github.com/spf13/afero" + + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tf2pulumi/il" ) const ( diff --git a/pkg/tf2pulumi/convert/eject.go b/pkg/tf2pulumi/convert/eject.go index 7d5ec9e03..3039bc7e1 100644 --- a/pkg/tf2pulumi/convert/eject.go +++ b/pkg/tf2pulumi/convert/eject.go @@ -22,9 +22,6 @@ import ( "path/filepath" "github.com/hashicorp/hcl/v2" - "github.com/spf13/afero" - - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tf2pulumi/il" "github.com/pulumi/pulumi/pkg/v3/codegen/convert" "github.com/pulumi/pulumi/pkg/v3/codegen/hcl2/syntax" "github.com/pulumi/pulumi/pkg/v3/codegen/pcl" @@ -33,6 +30,9 @@ import ( "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" "github.com/pulumi/pulumi/sdk/v3/go/common/workspace" + "github.com/spf13/afero" + + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tf2pulumi/il" ) type EjectOptions struct { diff --git a/pkg/tf2pulumi/convert/model_helpers.go b/pkg/tf2pulumi/convert/model_helpers.go index dd5197b6a..3c6be57c9 100644 --- a/pkg/tf2pulumi/convert/model_helpers.go +++ b/pkg/tf2pulumi/convert/model_helpers.go @@ -20,9 +20,8 @@ package convert import ( "fmt" - "github.com/hashicorp/hcl/v2" - //"strings" + "github.com/hashicorp/hcl/v2" "github.com/pulumi/pulumi/pkg/v3/codegen/hcl2/model" ) diff --git a/pkg/tf2pulumi/convert/model_helpers_test.go b/pkg/tf2pulumi/convert/model_helpers_test.go index 958363412..67b371dc8 100644 --- a/pkg/tf2pulumi/convert/model_helpers_test.go +++ b/pkg/tf2pulumi/convert/model_helpers_test.go @@ -18,10 +18,9 @@ import ( "fmt" "testing" + "github.com/pulumi/pulumi/pkg/v3/codegen/hcl2/model" "github.com/stretchr/testify/assert" "github.com/zclconf/go-cty/cty" - - "github.com/pulumi/pulumi/pkg/v3/codegen/hcl2/model" ) func TestSetConfigBlockType(t *testing.T) { diff --git a/pkg/tf2pulumi/convert/tf12_names.go b/pkg/tf2pulumi/convert/tf12_names.go index e42c65594..fad7bdc85 100644 --- a/pkg/tf2pulumi/convert/tf12_names.go +++ b/pkg/tf2pulumi/convert/tf12_names.go @@ -16,8 +16,6 @@ package convert import ( "fmt" - "golang.org/x/text/cases" - "golang.org/x/text/language" "sort" "strings" "unicode" @@ -26,6 +24,8 @@ import ( "github.com/hashicorp/hcl/v2" "github.com/pulumi/pulumi/pkg/v3/codegen/pcl" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + "golang.org/x/text/cases" + "golang.org/x/text/language" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" ) diff --git a/pkg/tfbridge/adapt_check_failures.go b/pkg/tfbridge/adapt_check_failures.go index 6abe44c19..22d118ff0 100644 --- a/pkg/tfbridge/adapt_check_failures.go +++ b/pkg/tfbridge/adapt_check_failures.go @@ -21,7 +21,6 @@ import ( "github.com/hashicorp/go-cty/cty" "github.com/pkg/errors" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go" diff --git a/pkg/tfbridge/auto_aliasing.go b/pkg/tfbridge/auto_aliasing.go index 191fae9f8..9bcc95995 100644 --- a/pkg/tfbridge/auto_aliasing.go +++ b/pkg/tfbridge/auto_aliasing.go @@ -16,11 +16,9 @@ package tfbridge import ( "sort" - _ "unsafe" // Needed for linkname "github.com/Masterminds/semver" - "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" diff --git a/pkg/tfbridge/auto_aliasing_test.go b/pkg/tfbridge/auto_aliasing_test.go index 223e46562..4739a6844 100644 --- a/pkg/tfbridge/auto_aliasing_test.go +++ b/pkg/tfbridge/auto_aliasing_test.go @@ -3,11 +3,10 @@ package tfbridge import ( "testing" + "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/schema" md "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/metadata" ) diff --git a/pkg/tfbridge/check_failures_test.go b/pkg/tfbridge/check_failures_test.go index c2a36704a..c8c8b266b 100644 --- a/pkg/tfbridge/check_failures_test.go +++ b/pkg/tfbridge/check_failures_test.go @@ -17,11 +17,11 @@ package tfbridge import ( "testing" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/stretchr/testify/assert" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/schema" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" ) func TestKeySuggestions(t *testing.T) { diff --git a/pkg/tfbridge/config_encoding.go b/pkg/tfbridge/config_encoding.go index a88717130..f09528aaa 100644 --- a/pkg/tfbridge/config_encoding.go +++ b/pkg/tfbridge/config_encoding.go @@ -20,11 +20,11 @@ import ( "sort" "github.com/golang/protobuf/ptypes/struct" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/propertyvalue" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" ) type ConfigEncoding struct { diff --git a/pkg/tfbridge/config_encoding_test.go b/pkg/tfbridge/config_encoding_test.go index 8d1d1be21..21aac6da3 100644 --- a/pkg/tfbridge/config_encoding_test.go +++ b/pkg/tfbridge/config_encoding_test.go @@ -18,13 +18,13 @@ import ( "fmt" "testing" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" + "github.com/stretchr/testify/assert" structpb "google.golang.org/protobuf/types/known/structpb" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" sch "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/schema" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" - "github.com/stretchr/testify/assert" ) func TestConfigEncoding(t *testing.T) { diff --git a/pkg/tfbridge/deconflict.go b/pkg/tfbridge/deconflict.go index e111e974e..228bf4742 100644 --- a/pkg/tfbridge/deconflict.go +++ b/pkg/tfbridge/deconflict.go @@ -20,12 +20,13 @@ import ( "strconv" "strings" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/info" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/walk" "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/propertyvalue" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) // Transforms inputs to enforce input bag conformance with ConflictsWith constraints. diff --git a/pkg/tfbridge/deconflict_test.go b/pkg/tfbridge/deconflict_test.go index 8a2b75596..1ceda4b9b 100644 --- a/pkg/tfbridge/deconflict_test.go +++ b/pkg/tfbridge/deconflict_test.go @@ -18,11 +18,12 @@ import ( "context" "testing" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/stretchr/testify/require" + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/schema" "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/logging" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" - "github.com/stretchr/testify/require" ) func TestDeconflict(t *testing.T) { diff --git a/pkg/tfbridge/diff_test.go b/pkg/tfbridge/diff_test.go index eaf2d620e..03f70d874 100644 --- a/pkg/tfbridge/diff_test.go +++ b/pkg/tfbridge/diff_test.go @@ -5,14 +5,13 @@ import ( "fmt" "testing" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" v2Schema "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" shimv1 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v1" diff --git a/pkg/tfbridge/examples_test.go b/pkg/tfbridge/examples_test.go index 8d4f8283a..6b5b78f12 100644 --- a/pkg/tfbridge/examples_test.go +++ b/pkg/tfbridge/examples_test.go @@ -1,8 +1,9 @@ package tfbridge import ( - "github.com/stretchr/testify/assert" "testing" + + "github.com/stretchr/testify/assert" ) func TestInlineExampleGetMarkdown(t *testing.T) { diff --git a/pkg/tfbridge/info.go b/pkg/tfbridge/info.go index 75b036e07..08f54f550 100644 --- a/pkg/tfbridge/info.go +++ b/pkg/tfbridge/info.go @@ -21,11 +21,10 @@ import ( "unicode" "github.com/blang/semver" - "golang.org/x/net/context" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + "golang.org/x/net/context" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/info" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" diff --git a/pkg/tfbridge/info/external_methods.go b/pkg/tfbridge/info/external_methods.go index edd23e023..06c7eff22 100644 --- a/pkg/tfbridge/info/external_methods.go +++ b/pkg/tfbridge/info/external_methods.go @@ -22,7 +22,6 @@ package info import ( "strings" - // Needed to unsafely import ApplyAutoAliases _ "unsafe" diff --git a/pkg/tfbridge/info/metadata.go b/pkg/tfbridge/info/metadata.go index 0c4ef3429..ed2858a1a 100644 --- a/pkg/tfbridge/info/metadata.go +++ b/pkg/tfbridge/info/metadata.go @@ -15,8 +15,9 @@ package info import ( - "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/metadata" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + + "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/metadata" ) // A KV store persisted between `tfgen` and a running provider. diff --git a/pkg/tfbridge/info/rename.go b/pkg/tfbridge/info/rename.go index 5e1267350..c0f0f852b 100644 --- a/pkg/tfbridge/info/rename.go +++ b/pkg/tfbridge/info/rename.go @@ -18,9 +18,10 @@ import ( "fmt" "strings" - shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) const RenamedEntitySuffix string = "_legacy" diff --git a/pkg/tfbridge/info/validate_test.go b/pkg/tfbridge/info/validate_test.go index f0666ce89..80bab1bef 100644 --- a/pkg/tfbridge/info/validate_test.go +++ b/pkg/tfbridge/info/validate_test.go @@ -18,9 +18,10 @@ import ( "context" "testing" + "github.com/stretchr/testify/assert" + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/schema" - "github.com/stretchr/testify/assert" ) func ref[T any](t T) *T { return &t } diff --git a/pkg/tfbridge/info_test.go b/pkg/tfbridge/info_test.go index 4ae6fd98d..32d39bb16 100644 --- a/pkg/tfbridge/info_test.go +++ b/pkg/tfbridge/info_test.go @@ -7,11 +7,12 @@ import ( "fmt" "testing" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/stretchr/testify/assert" + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" shimschema "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/schema" "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/logging" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" - "github.com/stretchr/testify/assert" ) func TestGetModuleMajorVersion(t *testing.T) { diff --git a/pkg/tfbridge/log.go b/pkg/tfbridge/log.go index 9f76d54a3..ac1ac24b1 100644 --- a/pkg/tfbridge/log.go +++ b/pkg/tfbridge/log.go @@ -21,10 +21,11 @@ import ( "os" "strings" - "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/logging" "github.com/pulumi/pulumi/pkg/v3/resource/provider" "github.com/pulumi/pulumi/sdk/v3/go/common/diag" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + + "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/logging" ) // LogRedirector creates a new redirection writer that takes as input plugin stderr output, and routes it to the diff --git a/pkg/tfbridge/log_test.go b/pkg/tfbridge/log_test.go index 5e983ae2c..80e95c93d 100644 --- a/pkg/tfbridge/log_test.go +++ b/pkg/tfbridge/log_test.go @@ -21,11 +21,10 @@ import ( "testing" "github.com/hexops/autogold/v2" - "github.com/stretchr/testify/assert" - "github.com/pulumi/pulumi/sdk/v3/go/common/diag" "github.com/pulumi/pulumi/sdk/v3/go/common/resource" pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go" + "github.com/stretchr/testify/assert" "github.com/pulumi/pulumi-terraform-bridge/v3/internal/testprovider" shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" diff --git a/pkg/tfbridge/names.go b/pkg/tfbridge/names.go index a9cf4ff8c..66f4996df 100644 --- a/pkg/tfbridge/names.go +++ b/pkg/tfbridge/names.go @@ -20,6 +20,7 @@ import ( "unicode" "github.com/pulumi/inflector" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/info" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/schema" diff --git a/pkg/tfbridge/names_test.go b/pkg/tfbridge/names_test.go index bfa02a98b..8faeae3fa 100644 --- a/pkg/tfbridge/names_test.go +++ b/pkg/tfbridge/names_test.go @@ -20,11 +20,11 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + schemav2 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - schemav2 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" shimv1 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v1" shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" ) diff --git a/pkg/tfbridge/provider.go b/pkg/tfbridge/provider.go old mode 100755 new mode 100644 index b092fea93..f30a1119c --- a/pkg/tfbridge/provider.go +++ b/pkg/tfbridge/provider.go @@ -24,22 +24,13 @@ import ( "time" "unicode" - pschema "github.com/pulumi/pulumi/pkg/v3/codegen/schema" - - "google.golang.org/grpc/status" - "google.golang.org/protobuf/types/known/emptypb" - "github.com/golang/glog" pbempty "github.com/golang/protobuf/ptypes/empty" pbstruct "github.com/golang/protobuf/ptypes/struct" "github.com/hashicorp/go-multierror" - "github.com/opentracing/opentracing-go" "github.com/pkg/errors" - "golang.org/x/net/context" - "google.golang.org/grpc/codes" - - "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/propertyvalue" + pschema "github.com/pulumi/pulumi/pkg/v3/codegen/schema" "github.com/pulumi/pulumi/pkg/v3/resource/provider" "github.com/pulumi/pulumi/sdk/v3/go/common/diag" "github.com/pulumi/pulumi/sdk/v3/go/common/resource" @@ -49,11 +40,16 @@ import ( "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" "github.com/pulumi/pulumi/sdk/v3/go/common/util/rpcutil/rpcerror" pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go" + "golang.org/x/net/context" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/emptypb" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/info" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/logging" "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/metadata" + "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/propertyvalue" "github.com/pulumi/pulumi-terraform-bridge/x/muxer" ) diff --git a/pkg/tfbridge/provider_test.go b/pkg/tfbridge/provider_test.go index 50240c1fc..f98ce692b 100644 --- a/pkg/tfbridge/provider_test.go +++ b/pkg/tfbridge/provider_test.go @@ -26,22 +26,21 @@ import ( "github.com/hashicorp/go-cty/cty" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + schemav2 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hexops/autogold/v2" + testutils "github.com/pulumi/providertest/replay" pschema "github.com/pulumi/pulumi/pkg/v3/codegen/schema" - pdiag "github.com/pulumi/pulumi/sdk/v3/go/common/diag" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "google.golang.org/protobuf/types/known/structpb" - - schemav2 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/pulumi/pulumi/pkg/v3/resource/provider" hostclient "github.com/pulumi/pulumi/pkg/v3/resource/provider" + pdiag "github.com/pulumi/pulumi/sdk/v3/go/common/diag" "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/types/known/structpb" - testutils "github.com/pulumi/providertest/replay" "github.com/pulumi/pulumi-terraform-bridge/v3/internal/testprovider" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" shimv1 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v1" diff --git a/pkg/tfbridge/schema.go b/pkg/tfbridge/schema.go index fb1c7fedb..43708f0fe 100644 --- a/pkg/tfbridge/schema.go +++ b/pkg/tfbridge/schema.go @@ -27,7 +27,6 @@ import ( "github.com/golang/glog" pbstruct "github.com/golang/protobuf/ptypes/struct" "github.com/pkg/errors" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" diff --git a/pkg/tfbridge/schema_test.go b/pkg/tfbridge/schema_test.go index 7f7a96fe8..a641b4783 100644 --- a/pkg/tfbridge/schema_test.go +++ b/pkg/tfbridge/schema_test.go @@ -28,20 +28,18 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" schemav2 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hexops/autogold/v2" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/pulumi/pulumi-terraform-bridge/v3/internal/testprovider" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/schema" shimv1 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v1" - shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" ) diff --git a/pkg/tfbridge/secrets.go b/pkg/tfbridge/secrets.go index d35c9a6e0..819f59fe0 100644 --- a/pkg/tfbridge/secrets.go +++ b/pkg/tfbridge/secrets.go @@ -17,8 +17,9 @@ package tfbridge import ( "context" - shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) // Ensures resource.MakeSecret is used to wrap any nested values that correspond to secret properties in the schema. A diff --git a/pkg/tfbridge/secrets_test.go b/pkg/tfbridge/secrets_test.go index 9d71f4170..a5b2788f8 100644 --- a/pkg/tfbridge/secrets_test.go +++ b/pkg/tfbridge/secrets_test.go @@ -18,9 +18,8 @@ import ( "context" "testing" - "github.com/stretchr/testify/assert" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/stretchr/testify/assert" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/schema" diff --git a/pkg/tfbridge/tests/provider_test.go b/pkg/tfbridge/tests/provider_test.go index 9b5af309d..91d9c4da6 100644 --- a/pkg/tfbridge/tests/provider_test.go +++ b/pkg/tfbridge/tests/provider_test.go @@ -8,16 +8,16 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/pulumi/providertest/replay" + "github.com/pulumi/pulumi/sdk/v3/go/common/diag" + "github.com/pulumi/pulumi/sdk/v3/go/common/diag/colors" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go" "github.com/stretchr/testify/assert" - "github.com/pulumi/providertest/replay" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen" shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" - "github.com/pulumi/pulumi/sdk/v3/go/common/diag" - "github.com/pulumi/pulumi/sdk/v3/go/common/diag/colors" ) // Demonstrating the use of the newTestProvider helper. diff --git a/pkg/tfbridge/tokens_test.go b/pkg/tfbridge/tokens_test.go index 68592ae55..36d7ae158 100644 --- a/pkg/tfbridge/tokens_test.go +++ b/pkg/tfbridge/tokens_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/hexops/autogold/v2" + ptokens "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -29,7 +30,6 @@ import ( "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/schema" "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/metadata" md "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/metadata" - ptokens "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" ) func TestTokensSingleModule(t *testing.T) { diff --git a/pkg/tfbridge/walk_test.go b/pkg/tfbridge/walk_test.go index 4f8d21397..e21c52f3e 100644 --- a/pkg/tfbridge/walk_test.go +++ b/pkg/tfbridge/walk_test.go @@ -18,11 +18,10 @@ import ( "strings" "testing" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/schema" shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" diff --git a/pkg/tfbridge/x/tokens.go b/pkg/tfbridge/x/tokens.go index e729a3a9b..7353b8845 100644 --- a/pkg/tfbridge/x/tokens.go +++ b/pkg/tfbridge/x/tokens.go @@ -21,13 +21,13 @@ import ( "unicode" "github.com/Masterminds/semver" + "github.com/pulumi/pulumi/pkg/v3/codegen/cgstrings" + "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" b "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" md "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/metadata" - "github.com/pulumi/pulumi/pkg/v3/codegen/cgstrings" - "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) const ( diff --git a/pkg/tfgen/convert_cli.go b/pkg/tfgen/convert_cli.go index 1d1687f03..c1c0abf2d 100644 --- a/pkg/tfgen/convert_cli.go +++ b/pkg/tfgen/convert_cli.go @@ -27,9 +27,7 @@ import ( "strings" "github.com/hashicorp/hcl/v2" - hcl2java "github.com/pulumi/pulumi-java/pkg/codegen/java" - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" hcl2yaml "github.com/pulumi/pulumi-yaml/pkg/pulumiyaml/codegen" hcl2dotnet "github.com/pulumi/pulumi/pkg/v3/codegen/dotnet" hcl2go "github.com/pulumi/pulumi/pkg/v3/codegen/go" @@ -42,6 +40,8 @@ import ( "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" "github.com/pulumi/pulumi/sdk/v3/go/common/util/cmdutil" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" ) func cliConverterEnabled() bool { diff --git a/pkg/tfgen/convert_cli_test.go b/pkg/tfgen/convert_cli_test.go index a4a11e594..e0219b490 100644 --- a/pkg/tfgen/convert_cli_test.go +++ b/pkg/tfgen/convert_cli_test.go @@ -29,10 +29,6 @@ import ( "github.com/hashicorp/hcl/v2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hexops/autogold/v2" - "github.com/spf13/afero" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - pschema "github.com/pulumi/pulumi/pkg/v3/codegen/schema" "github.com/pulumi/pulumi/sdk/v3/go/common/apitype" "github.com/pulumi/pulumi/sdk/v3/go/common/diag" @@ -41,6 +37,9 @@ import ( "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" "github.com/pulumi/pulumi/sdk/v3/go/common/workspace" + "github.com/spf13/afero" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" bridgetesting "github.com/pulumi/pulumi-terraform-bridge/v3/internal/testing" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" diff --git a/pkg/tfgen/convert_test.go b/pkg/tfgen/convert_test.go index 8dafa3dfc..5c9a51c7d 100644 --- a/pkg/tfgen/convert_test.go +++ b/pkg/tfgen/convert_test.go @@ -21,12 +21,12 @@ import ( "strings" "testing" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" "github.com/spf13/afero" "github.com/stretchr/testify/require" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tf2pulumi/convert" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) func TestConvert(t *testing.T) { diff --git a/pkg/tfgen/docs.go b/pkg/tfgen/docs.go index af007744a..80a067413 100644 --- a/pkg/tfgen/docs.go +++ b/pkg/tfgen/docs.go @@ -30,15 +30,14 @@ import ( "github.com/hashicorp/go-multierror" "github.com/hashicorp/hcl/v2" - bf "github.com/russross/blackfriday/v2" - "github.com/spf13/afero" - "golang.org/x/text/cases" - "golang.org/x/text/language" - "github.com/pulumi/pulumi/pkg/v3/codegen/python" "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" "github.com/pulumi/pulumi/sdk/v3/go/common/util/cmdutil" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + bf "github.com/russross/blackfriday/v2" + "github.com/spf13/afero" + "golang.org/x/text/cases" + "golang.org/x/text/language" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tf2pulumi/convert" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" diff --git a/pkg/tfgen/docs_test.go b/pkg/tfgen/docs_test.go index 61d3b3faa..40da01616 100644 --- a/pkg/tfgen/docs_test.go +++ b/pkg/tfgen/docs_test.go @@ -29,14 +29,13 @@ import ( "testing" "text/template" - "github.com/spf13/afero" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/pulumi/pulumi/sdk/v3/go/common/diag" "github.com/pulumi/pulumi/sdk/v3/go/common/diag/colors" "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" "github.com/pulumi/pulumi/sdk/v3/go/common/util/cmdutil" + "github.com/spf13/afero" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen/internal/testprovider" diff --git a/pkg/tfgen/examples_cache.go b/pkg/tfgen/examples_cache.go index 13fd3cd1d..c71fd3cce 100644 --- a/pkg/tfgen/examples_cache.go +++ b/pkg/tfgen/examples_cache.go @@ -31,8 +31,9 @@ import ( "path/filepath" "strings" - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" ) const ( diff --git a/pkg/tfgen/generate.go b/pkg/tfgen/generate.go index 49ee6121e..5973cf243 100644 --- a/pkg/tfgen/generate.go +++ b/pkg/tfgen/generate.go @@ -18,8 +18,6 @@ import ( "context" "encoding/json" "fmt" - "golang.org/x/text/cases" - "golang.org/x/text/language" "os" "path" "path/filepath" @@ -42,7 +40,10 @@ import ( "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" "github.com/pulumi/pulumi/sdk/v3/go/common/util/cmdutil" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + schemaTools "github.com/pulumi/schema-tools/pkg" "github.com/spf13/afero" + "golang.org/x/text/cases" + "golang.org/x/text/language" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tf2pulumi/il" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" @@ -50,7 +51,6 @@ import ( shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/schema" "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/metadata" - schemaTools "github.com/pulumi/schema-tools/pkg" ) const ( diff --git a/pkg/tfgen/generate_schema.go b/pkg/tfgen/generate_schema.go index 7ab9456b6..2f68add19 100644 --- a/pkg/tfgen/generate_schema.go +++ b/pkg/tfgen/generate_schema.go @@ -27,9 +27,6 @@ import ( "sort" "strings" - "golang.org/x/text/cases" - "golang.org/x/text/language" - "github.com/hashicorp/go-multierror" "github.com/pkg/errors" "github.com/pulumi/inflector" @@ -41,6 +38,8 @@ import ( pschema "github.com/pulumi/pulumi/pkg/v3/codegen/schema" "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + "golang.org/x/text/cases" + "golang.org/x/text/language" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen/internal/paths" diff --git a/pkg/tfgen/generate_schema_test.go b/pkg/tfgen/generate_schema_test.go index 9ad6e7cf1..ff5201fa8 100644 --- a/pkg/tfgen/generate_schema_test.go +++ b/pkg/tfgen/generate_schema_test.go @@ -21,6 +21,12 @@ import ( "testing" "text/template" + csgen "github.com/pulumi/pulumi/pkg/v3/codegen/dotnet" + gogen "github.com/pulumi/pulumi/pkg/v3/codegen/go" + tsgen "github.com/pulumi/pulumi/pkg/v3/codegen/nodejs" + pygen "github.com/pulumi/pulumi/pkg/v3/codegen/python" + "github.com/pulumi/pulumi/sdk/v3/go/common/diag" + "github.com/pulumi/pulumi/sdk/v3/go/common/diag/colors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -29,12 +35,6 @@ import ( "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfgen/internal/testprovider" "github.com/pulumi/pulumi-terraform-bridge/v3/unstable/metadata" "github.com/pulumi/pulumi-terraform-bridge/x/muxer" - csgen "github.com/pulumi/pulumi/pkg/v3/codegen/dotnet" - gogen "github.com/pulumi/pulumi/pkg/v3/codegen/go" - tsgen "github.com/pulumi/pulumi/pkg/v3/codegen/nodejs" - pygen "github.com/pulumi/pulumi/pkg/v3/codegen/python" - "github.com/pulumi/pulumi/sdk/v3/go/common/diag" - "github.com/pulumi/pulumi/sdk/v3/go/common/diag/colors" ) // TestRegress611 tests against test_data/regress-611-schema.json. diff --git a/pkg/tfgen/generate_test.go b/pkg/tfgen/generate_test.go index 789d9596b..e0e726f4a 100644 --- a/pkg/tfgen/generate_test.go +++ b/pkg/tfgen/generate_test.go @@ -23,13 +23,12 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - pschema "github.com/pulumi/pulumi/pkg/v3/codegen/schema" "github.com/pulumi/pulumi/sdk/v3/go/common/diag" "github.com/pulumi/pulumi/sdk/v3/go/common/diag/colors" "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" bridgetesting "github.com/pulumi/pulumi-terraform-bridge/v3/internal/testing" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tf2pulumi/il" diff --git a/pkg/tfgen/internal/testprovider/miniaws.go b/pkg/tfgen/internal/testprovider/miniaws.go index ec3cb7a3d..8515407e7 100644 --- a/pkg/tfgen/internal/testprovider/miniaws.go +++ b/pkg/tfgen/internal/testprovider/miniaws.go @@ -17,10 +17,11 @@ package testprovider import ( "bytes" + "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" + testproviderdata "github.com/pulumi/pulumi-terraform-bridge/v3/internal/testprovider" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" - "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" ) func ProviderMiniAws() tfbridge.ProviderInfo { diff --git a/pkg/tfgen/internal/testprovider/minimuxed.go b/pkg/tfgen/internal/testprovider/minimuxed.go index 62eae53d2..29c11de1b 100644 --- a/pkg/tfgen/internal/testprovider/minimuxed.go +++ b/pkg/tfgen/internal/testprovider/minimuxed.go @@ -3,12 +3,13 @@ package testprovider import ( "context" - testproviderdata "github.com/pulumi/pulumi-terraform-bridge/v3/internal/testprovider" - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" - shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" "github.com/pulumi/pulumi/pkg/v3/codegen/schema" "github.com/pulumi/pulumi/pkg/v3/resource/provider" pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go" + + testproviderdata "github.com/pulumi/pulumi-terraform-bridge/v3/internal/testprovider" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" + shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" ) func ProviderMiniMuxed() tfbridge.ProviderInfo { diff --git a/pkg/tfgen/internal/testprovider/minimuxed_replace.go b/pkg/tfgen/internal/testprovider/minimuxed_replace.go index 5bc60137e..70a7dc6eb 100644 --- a/pkg/tfgen/internal/testprovider/minimuxed_replace.go +++ b/pkg/tfgen/internal/testprovider/minimuxed_replace.go @@ -3,12 +3,13 @@ package testprovider import ( "context" - testproviderdata "github.com/pulumi/pulumi-terraform-bridge/v3/internal/testprovider" - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" - shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" "github.com/pulumi/pulumi/pkg/v3/codegen/schema" "github.com/pulumi/pulumi/pkg/v3/resource/provider" pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go" + + testproviderdata "github.com/pulumi/pulumi-terraform-bridge/v3/internal/testprovider" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" + shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" ) func ProviderMiniMuxedReplace() tfbridge.ProviderInfo { diff --git a/pkg/tfgen/internal/testprovider/minirandom.go b/pkg/tfgen/internal/testprovider/minirandom.go index a55498807..dfd05110a 100644 --- a/pkg/tfgen/internal/testprovider/minirandom.go +++ b/pkg/tfgen/internal/testprovider/minirandom.go @@ -17,11 +17,11 @@ package testprovider import ( "unicode" - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" - shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" testproviderdata "github.com/pulumi/pulumi-terraform-bridge/v3/internal/testprovider" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" + shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" ) func ProviderMiniRandom() tfbridge.ProviderInfo { diff --git a/pkg/tfgen/internal/testprovider/minitalos.go b/pkg/tfgen/internal/testprovider/minitalos.go index 2388d22f1..d5be36e71 100644 --- a/pkg/tfgen/internal/testprovider/minitalos.go +++ b/pkg/tfgen/internal/testprovider/minitalos.go @@ -16,9 +16,10 @@ package testprovider import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + cschema "github.com/pulumi/pulumi/pkg/v3/codegen/schema" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" - cschema "github.com/pulumi/pulumi/pkg/v3/codegen/schema" ) func ProviderMiniTalos() tfbridge.ProviderInfo { diff --git a/pkg/tfgen/internal/testprovider/regress611.go b/pkg/tfgen/internal/testprovider/regress611.go index a05b66505..a48df151f 100644 --- a/pkg/tfgen/internal/testprovider/regress611.go +++ b/pkg/tfgen/internal/testprovider/regress611.go @@ -19,11 +19,11 @@ import ( "strings" "unicode" - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" - shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" testproviderdata "github.com/pulumi/pulumi-terraform-bridge/v3/internal/testprovider" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" + shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" ) // Minified variant of pulumi-aws provider extracted from diff --git a/pkg/tfgen/main.go b/pkg/tfgen/main.go index 0d1d54293..2e7ff313a 100644 --- a/pkg/tfgen/main.go +++ b/pkg/tfgen/main.go @@ -24,11 +24,12 @@ import ( "runtime/trace" "github.com/golang/glog" - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" "github.com/pulumi/pulumi/sdk/v3/go/common/util/cmdutil" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" "github.com/spf13/afero" "github.com/spf13/cobra" + + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" ) // Main executes the TFGen process for the given package pkg and provider prov. diff --git a/pkg/tfgen/pluginHost_test.go b/pkg/tfgen/pluginHost_test.go index ec1fb6e0a..93662cadd 100644 --- a/pkg/tfgen/pluginHost_test.go +++ b/pkg/tfgen/pluginHost_test.go @@ -19,10 +19,9 @@ import ( "testing" "github.com/blang/semver" - "github.com/stretchr/testify/require" - "github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin" "github.com/pulumi/pulumi/sdk/v3/go/common/tokens" + "github.com/stretchr/testify/require" ) func TestCachingPluginHost(t *testing.T) { diff --git a/pkg/tfshim/sdk-v1/instance_diff.go b/pkg/tfshim/sdk-v1/instance_diff.go index 2badd8c27..90ab1a0d2 100644 --- a/pkg/tfshim/sdk-v1/instance_diff.go +++ b/pkg/tfshim/sdk-v1/instance_diff.go @@ -6,9 +6,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) var _ = shim.InstanceDiff(v1InstanceDiff{}) diff --git a/pkg/tfshim/sdk-v1/instance_state.go b/pkg/tfshim/sdk-v1/instance_state.go index fa3b2664b..c36a7175b 100644 --- a/pkg/tfshim/sdk-v1/instance_state.go +++ b/pkg/tfshim/sdk-v1/instance_state.go @@ -5,8 +5,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/terraform" - shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" diff_reader "github.com/pulumi/terraform-diff-reader/sdk-v1" + + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) var _ = shim.InstanceState(v1InstanceState{}) diff --git a/pkg/tfshim/sdk-v1/provider.go b/pkg/tfshim/sdk-v1/provider.go index 3027f4870..7f5044f81 100644 --- a/pkg/tfshim/sdk-v1/provider.go +++ b/pkg/tfshim/sdk-v1/provider.go @@ -6,6 +6,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/logging" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/terraform" + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) diff --git a/pkg/tfshim/sdk-v1/resource.go b/pkg/tfshim/sdk-v1/resource.go index 4e4201183..8eea854ac 100644 --- a/pkg/tfshim/sdk-v1/resource.go +++ b/pkg/tfshim/sdk-v1/resource.go @@ -5,6 +5,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/terraform" + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) diff --git a/pkg/tfshim/sdk-v1/schema.go b/pkg/tfshim/sdk-v1/schema.go index a39333702..a9286d26a 100644 --- a/pkg/tfshim/sdk-v1/schema.go +++ b/pkg/tfshim/sdk-v1/schema.go @@ -3,6 +3,7 @@ package sdkv1 import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/terraform" + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) diff --git a/pkg/tfshim/sdk-v2/cty.go b/pkg/tfshim/sdk-v2/cty.go index 5c88658c0..dc88700f3 100644 --- a/pkg/tfshim/sdk-v2/cty.go +++ b/pkg/tfshim/sdk-v2/cty.go @@ -20,12 +20,10 @@ import ( "math/big" "github.com/golang/glog" - "github.com/hashicorp/go-cty/cty" ctyjson "github.com/hashicorp/go-cty/cty/json" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) diff --git a/pkg/tfshim/sdk-v2/cty_test.go b/pkg/tfshim/sdk-v2/cty_test.go index ac6c99f3c..6b103d83c 100644 --- a/pkg/tfshim/sdk-v2/cty_test.go +++ b/pkg/tfshim/sdk-v2/cty_test.go @@ -4,16 +4,15 @@ import ( "math/big" "testing" - "github.com/stretchr/testify/require" - "pgregory.net/rapid" - "github.com/hashicorp/go-cty/cty" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + "github.com/stretchr/testify/require" + "pgregory.net/rapid" "github.com/pulumi/pulumi-terraform-bridge/v3/internal/testprovider" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2/internal/rapid" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) var awsSSMParameterSchema = &schema.Resource{ diff --git a/pkg/tfshim/sdk-v2/defaults.go b/pkg/tfshim/sdk-v2/defaults.go index 16233d860..52b4ecfc8 100644 --- a/pkg/tfshim/sdk-v2/defaults.go +++ b/pkg/tfshim/sdk-v2/defaults.go @@ -16,7 +16,6 @@ package sdkv2 import ( "github.com/golang/glog" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/pkg/tfshim/sdk-v2/defaults_test.go b/pkg/tfshim/sdk-v2/defaults_test.go index b2165389b..e5291d519 100644 --- a/pkg/tfshim/sdk-v2/defaults_test.go +++ b/pkg/tfshim/sdk-v2/defaults_test.go @@ -17,10 +17,10 @@ package sdkv2_test import ( "testing" - "github.com/stretchr/testify/assert" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/stretchr/testify/assert" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2" ) diff --git a/pkg/tfshim/sdk-v2/instance_diff.go b/pkg/tfshim/sdk-v2/instance_diff.go index c12ad306a..6a710fa3e 100644 --- a/pkg/tfshim/sdk-v2/instance_diff.go +++ b/pkg/tfshim/sdk-v2/instance_diff.go @@ -6,8 +6,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) var _ = shim.InstanceDiff(v2InstanceDiff{}) diff --git a/pkg/tfshim/sdk-v2/instance_state.go b/pkg/tfshim/sdk-v2/instance_state.go index a33d0c233..0265fe445 100644 --- a/pkg/tfshim/sdk-v2/instance_state.go +++ b/pkg/tfshim/sdk-v2/instance_state.go @@ -22,11 +22,10 @@ import ( "github.com/hashicorp/go-cty/cty" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + diff_reader "github.com/pulumi/terraform-diff-reader/sdk-v2" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" - diff_reader "github.com/pulumi/terraform-diff-reader/sdk-v2" ) var _ = shim.InstanceState(v2InstanceState{}) diff --git a/pkg/tfshim/sdk-v2/internal/rapid/generators.go b/pkg/tfshim/sdk-v2/internal/rapid/generators.go index 28ff53091..a82248641 100644 --- a/pkg/tfshim/sdk-v2/internal/rapid/generators.go +++ b/pkg/tfshim/sdk-v2/internal/rapid/generators.go @@ -1,11 +1,9 @@ package rapidgen import ( - "pgregory.net/rapid" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + "pgregory.net/rapid" ) // schema.Resource docs state this is an abstraction over resources proper, data sources and blocks. diff --git a/pkg/tfshim/sdk-v2/proposed_new.go b/pkg/tfshim/sdk-v2/proposed_new.go index b093504da..0451c6197 100644 --- a/pkg/tfshim/sdk-v2/proposed_new.go +++ b/pkg/tfshim/sdk-v2/proposed_new.go @@ -17,11 +17,11 @@ package sdkv2 import ( hcty "github.com/hashicorp/go-cty/cty" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" "github.com/zclconf/go-cty/cty" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2/internal/tf/configs/configschema" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2/internal/tf/plans/objchange" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) func proposedNew(res *schema.Resource, prior, config hcty.Value) (hcty.Value, error) { diff --git a/pkg/tfshim/sdk-v2/proposed_new_test.go b/pkg/tfshim/sdk-v2/proposed_new_test.go index 3e7a22e59..08cca1758 100644 --- a/pkg/tfshim/sdk-v2/proposed_new_test.go +++ b/pkg/tfshim/sdk-v2/proposed_new_test.go @@ -19,10 +19,9 @@ import ( "testing" "github.com/hashicorp/go-cty/cty" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func TestProposedNew(t *testing.T) { diff --git a/pkg/tfshim/sdk-v2/provider.go b/pkg/tfshim/sdk-v2/provider.go index 2eef34b72..d10f51eea 100644 --- a/pkg/tfshim/sdk-v2/provider.go +++ b/pkg/tfshim/sdk-v2/provider.go @@ -9,8 +9,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" testing "github.com/mitchellh/go-testing-interface" - shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi/sdk/v3/go/common/util/cmdutil" + + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) var _ = shim.Provider(v2Provider{}) diff --git a/pkg/tfshim/sdk-v2/provider2.go b/pkg/tfshim/sdk-v2/provider2.go index 7836cc088..65fb6aa70 100644 --- a/pkg/tfshim/sdk-v2/provider2.go +++ b/pkg/tfshim/sdk-v2/provider2.go @@ -14,9 +14,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) type v2Resource2 struct { diff --git a/pkg/tfshim/sdk-v2/provider_diff_test.go b/pkg/tfshim/sdk-v2/provider_diff_test.go index adc214b53..d943ba950 100644 --- a/pkg/tfshim/sdk-v2/provider_diff_test.go +++ b/pkg/tfshim/sdk-v2/provider_diff_test.go @@ -21,9 +21,10 @@ import ( "github.com/hashicorp/go-cty/cty" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) func TestRawPlanSet(t *testing.T) { diff --git a/pkg/tfshim/sdk-v2/resource.go b/pkg/tfshim/sdk-v2/resource.go index f0b595582..ded02c2a1 100644 --- a/pkg/tfshim/sdk-v2/resource.go +++ b/pkg/tfshim/sdk-v2/resource.go @@ -6,6 +6,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) diff --git a/pkg/tfshim/sdk-v2/schema.go b/pkg/tfshim/sdk-v2/schema.go index 3b7721cc9..a2631db50 100644 --- a/pkg/tfshim/sdk-v2/schema.go +++ b/pkg/tfshim/sdk-v2/schema.go @@ -3,6 +3,7 @@ package sdkv2 import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" ) diff --git a/pkg/tfshim/tfplugin5/diagnostics.go b/pkg/tfshim/tfplugin5/diagnostics.go index 45b686fc9..3e967b153 100644 --- a/pkg/tfshim/tfplugin5/diagnostics.go +++ b/pkg/tfshim/tfplugin5/diagnostics.go @@ -3,8 +3,8 @@ package tfplugin5 import ( "github.com/hashicorp/go-cty/cty" "github.com/hashicorp/go-multierror" - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/diagnostics" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/diagnostics" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/tfplugin5/proto" ) diff --git a/pkg/tfshim/tfplugin5/diagnostics_test.go b/pkg/tfshim/tfplugin5/diagnostics_test.go index 8d511aff5..707f08b5c 100644 --- a/pkg/tfshim/tfplugin5/diagnostics_test.go +++ b/pkg/tfshim/tfplugin5/diagnostics_test.go @@ -1,12 +1,12 @@ package tfplugin5 import ( - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/diagnostics" "testing" "github.com/hashicorp/go-multierror" "github.com/stretchr/testify/assert" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/diagnostics" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/tfplugin5/proto" ) diff --git a/pkg/tfshim/tfplugin5/instance_diff.go b/pkg/tfshim/tfplugin5/instance_diff.go index c8848f6cb..050b85172 100644 --- a/pkg/tfshim/tfplugin5/instance_diff.go +++ b/pkg/tfshim/tfplugin5/instance_diff.go @@ -8,10 +8,10 @@ import ( "github.com/hashicorp/go-cty/cty" "github.com/hashicorp/go-cty/cty/convert" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/tfplugin5/proto" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) // This corresponds to the TF plugin SDK's timeouts key. diff --git a/pkg/tfshim/tfplugin5/provider_test.go b/pkg/tfshim/tfplugin5/provider_test.go index 6647b6c30..e0ee53e44 100644 --- a/pkg/tfshim/tfplugin5/provider_test.go +++ b/pkg/tfshim/tfplugin5/provider_test.go @@ -14,13 +14,13 @@ import ( "github.com/hashicorp/go-cty/cty" "github.com/hashicorp/go-hclog" goplugin "github.com/hashicorp/go-plugin" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/diagnostics" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/schema" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) type testLogger struct { diff --git a/pkg/tfshim/tfplugin5/resource.go b/pkg/tfshim/tfplugin5/resource.go index 87ed3f38a..42529710a 100644 --- a/pkg/tfshim/tfplugin5/resource.go +++ b/pkg/tfshim/tfplugin5/resource.go @@ -5,6 +5,7 @@ import ( "time" "github.com/hashicorp/go-cty/cty" + shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/schema" ) diff --git a/pkg/tfshim/tfplugin5/schema.go b/pkg/tfshim/tfplugin5/schema.go index f06c8519f..1d3b4656f 100644 --- a/pkg/tfshim/tfplugin5/schema.go +++ b/pkg/tfshim/tfplugin5/schema.go @@ -2,9 +2,9 @@ package tfplugin5 import ( "github.com/hashicorp/go-cty/cty" + "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) // UnknownVariableValue is the sentinal defined in github.com/hashicorp/terraform/configs/hcl2shim, diff --git a/pkg/tfshim/walk/walk.go b/pkg/tfshim/walk/walk.go index dbc384e5a..e3b207e17 100644 --- a/pkg/tfshim/walk/walk.go +++ b/pkg/tfshim/walk/walk.go @@ -22,9 +22,8 @@ import ( "strings" hcty "github.com/hashicorp/go-cty/cty" - "github.com/zclconf/go-cty/cty" - "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" + "github.com/zclconf/go-cty/cty" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim" "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/schema" diff --git a/scripts/build.go b/scripts/build.go index 7611fba0a..341774028 100644 --- a/scripts/build.go +++ b/scripts/build.go @@ -19,7 +19,9 @@ func main() { switch os.Args[1] { case "lint": - lintMain() + lintMain(false) + case "fix-lint": + lintMain(true) case "update-pulumi-deps": updatePulumiDeps() case "latest-pulumi-version": @@ -61,12 +63,16 @@ func fileContains(path string, search string) bool { return bytes.Contains(b, []byte(search)) } -func lintMain() { +func lintMain(fix bool) { roots := findGoModuleRoots() failed := false for _, m := range roots { fmt.Printf("%q: linting ...", m) - err := execCommand(m, "golangci-lint", "run") + args := []string{"run", "--path-prefix=" + m} + if fix { + args = append(args, "--fix") + } + err := execCommand(m, "golangci-lint", args...) if err == nil { fmt.Printf(" done\n") } else { diff --git a/testing/x/replay.go b/testing/x/replay.go index 7bf361f40..98e0770d5 100644 --- a/testing/x/replay.go +++ b/testing/x/replay.go @@ -21,14 +21,12 @@ import ( "strings" "testing" + pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" jsonpb "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/types/known/emptypb" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - pulumirpc "github.com/pulumi/pulumi/sdk/v3/proto/go" ) // Replay executes a request from a provider operation log against an in-memory resource provider server and asserts diff --git a/unstable/logging/logging.go b/unstable/logging/logging.go index c28a7831a..6dc613b3b 100644 --- a/unstable/logging/logging.go +++ b/unstable/logging/logging.go @@ -25,7 +25,6 @@ import ( "github.com/hashicorp/go-hclog" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-plugin-log/tfsdklog" - "github.com/pulumi/pulumi/pkg/v3/resource/provider" "github.com/pulumi/pulumi/sdk/v3/go/common/diag" "github.com/pulumi/pulumi/sdk/v3/go/common/resource" diff --git a/unstable/logging/logging_test.go b/unstable/logging/logging_test.go index f8ba811f3..3569df161 100644 --- a/unstable/logging/logging_test.go +++ b/unstable/logging/logging_test.go @@ -21,11 +21,10 @@ import ( "github.com/hashicorp/go-hclog" "github.com/hashicorp/terraform-plugin-log/tflog" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/pulumi/pulumi/sdk/v3/go/common/diag" "github.com/pulumi/pulumi/sdk/v3/go/common/resource" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestLogging(t *testing.T) { diff --git a/unstable/propertyvalue/ignore_changes_test.go b/unstable/propertyvalue/ignore_changes_test.go index 4edcf56df..5cc9cfc37 100644 --- a/unstable/propertyvalue/ignore_changes_test.go +++ b/unstable/propertyvalue/ignore_changes_test.go @@ -17,10 +17,9 @@ package propertyvalue import ( "testing" + "github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - - "github.com/pulumi/pulumi/sdk/v3/go/common/resource" ) func TestIgnoreChanges(t *testing.T) { diff --git a/unstable/propertyvalue/propertyvalue_test.go b/unstable/propertyvalue/propertyvalue_test.go index b46c861c3..06198a4c9 100644 --- a/unstable/propertyvalue/propertyvalue_test.go +++ b/unstable/propertyvalue/propertyvalue_test.go @@ -17,9 +17,8 @@ package propertyvalue import ( "testing" - "pgregory.net/rapid" - rtesting "github.com/pulumi/pulumi/sdk/v3/go/common/resource/testing" + "pgregory.net/rapid" ) func TestRemoveSecrets(t *testing.T) { diff --git a/x/muxer/mapping_test.go b/x/muxer/mapping_test.go index 713833633..98a27c337 100644 --- a/x/muxer/mapping_test.go +++ b/x/muxer/mapping_test.go @@ -17,10 +17,9 @@ package muxer import ( "testing" + "github.com/pulumi/pulumi/pkg/v3/codegen/schema" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - - "github.com/pulumi/pulumi/pkg/v3/codegen/schema" ) func TestMergeSchemasAndComputeDispatchTable(t *testing.T) { diff --git a/x/muxer/tests/muxer_test.go b/x/muxer/tests/muxer_test.go index ca8f66b8e..237a1eeea 100644 --- a/x/muxer/tests/muxer_test.go +++ b/x/muxer/tests/muxer_test.go @@ -22,6 +22,7 @@ import ( "reflect" "testing" + testutils "github.com/pulumi/providertest/replay" "github.com/pulumi/pulumi/pkg/v3/resource/provider" rpc "github.com/pulumi/pulumi/sdk/v3/proto/go" "github.com/stretchr/testify/assert" @@ -30,8 +31,6 @@ import ( "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/emptypb" - testutils "github.com/pulumi/providertest/replay" - "github.com/pulumi/pulumi-terraform-bridge/x/muxer" )