diff --git a/.gitignore b/.gitignore index 325da327..fee1d00d 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ yarn.lock ci-scripts **/schema.go +**/schema-embed.json **/version.txt **/nuget **/dist diff --git a/provider/cmd/pulumi-resource-spotinst/generate.go b/provider/cmd/pulumi-resource-spotinst/generate.go index a548fda8..414389e2 100644 --- a/provider/cmd/pulumi-resource-spotinst/generate.go +++ b/provider/cmd/pulumi-resource-spotinst/generate.go @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -// +build ignore +//go:build ignore package main import ( "encoding/json" - "fmt" + "errors" + "io/fs" "io/ioutil" "log" "os" @@ -49,9 +50,13 @@ func main() { log.Fatalf("cannot reserialize schema: %v", err) } - err = ioutil.WriteFile("./schema.go", []byte(fmt.Sprintf(`package main -var pulumiSchema = %#v -`, versionedContents)), 0600) + // Clean up schema.go as it may be present & gitignored and tolerate an error if the file isn't present. + err = os.Remove("./schema.go") + if err != nil && !errors.Is(err, fs.ErrNotExist) { + log.Fatal(err) + } + + err = ioutil.WriteFile("./schema-embed.json", versionedContents, 0600) if err != nil { log.Fatal(err) } diff --git a/provider/cmd/pulumi-resource-spotinst/main.go b/provider/cmd/pulumi-resource-spotinst/main.go index 2486b9bd..134f6361 100644 --- a/provider/cmd/pulumi-resource-spotinst/main.go +++ b/provider/cmd/pulumi-resource-spotinst/main.go @@ -17,12 +17,16 @@ package main import ( - "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" + _ "embed" spotinst "github.com/pulumi/pulumi-spotinst/provider/v3" "github.com/pulumi/pulumi-spotinst/provider/v3/pkg/version" + "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge" ) +//go:embed schema-embed.json +var pulumiSchema []byte + func main() { // Modify the path to point to the new provider tfbridge.Main("spotinst", version.Version, spotinst.Provider(), pulumiSchema) diff --git a/provider/go.mod b/provider/go.mod index 5be86d14..6a03ab4d 100644 --- a/provider/go.mod +++ b/provider/go.mod @@ -8,6 +8,14 @@ require ( github.com/spotinst/terraform-provider-spotinst v1.32.0 ) +replace ( + github.com/hashicorp/go-getter v1.5.0 => github.com/hashicorp/go-getter v1.4.0 + github.com/hashicorp/terraform-exec => github.com/hashicorp/terraform-exec v0.15.0 + github.com/hashicorp/terraform-plugin-sdk/v2 => github.com/pulumi/terraform-plugin-sdk/v2 v2.0.0-20220505215311-795430389fa7 + github.com/hashicorp/vault => github.com/hashicorp/vault v1.2.0 + github.com/spotinst/terraform-provider-spotinst => github.com/pulumi/terraform-provider-spotinst v1.33.1-0.20220627133113-a1bc6c524aae +) + require ( cloud.google.com/go v0.100.2 // indirect cloud.google.com/go/compute v1.5.0 // indirect @@ -208,11 +216,3 @@ require ( gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect sourcegraph.com/sourcegraph/appdash v0.0.0-20211028080628-e2786a622600 // indirect ) - -replace ( - github.com/hashicorp/go-getter v1.5.0 => github.com/hashicorp/go-getter v1.4.0 - github.com/hashicorp/terraform-exec => github.com/hashicorp/terraform-exec v0.15.0 - github.com/hashicorp/terraform-plugin-sdk/v2 => github.com/pulumi/terraform-plugin-sdk/v2 v2.0.0-20220505215311-795430389fa7 - github.com/hashicorp/vault => github.com/hashicorp/vault v1.2.0 - github.com/spotinst/terraform-provider-spotinst => github.com/pulumi/terraform-provider-spotinst v1.33.1-0.20220613153615-7f039c17be85 -) diff --git a/provider/go.sum b/provider/go.sum index 280d8e07..699ac0aa 100644 --- a/provider/go.sum +++ b/provider/go.sum @@ -813,8 +813,8 @@ github.com/pulumi/terraform-diff-reader v0.0.0-20201211191010-ad4715e9285e h1:Di github.com/pulumi/terraform-diff-reader v0.0.0-20201211191010-ad4715e9285e/go.mod h1:sZ9FUzGO+yM41hsQHs/yIcj/Y993qMdBxBU5mpDmAfQ= github.com/pulumi/terraform-plugin-sdk/v2 v2.0.0-20220505215311-795430389fa7 h1:RAiGj0GniixD+G+HuUzFWZh2VKdQ50nv5+EmkKG1u3E= github.com/pulumi/terraform-plugin-sdk/v2 v2.0.0-20220505215311-795430389fa7/go.mod h1:TPjMXvpPNWagHzYOmVPzzRRIBTuaLVukR+esL08tgzg= -github.com/pulumi/terraform-provider-spotinst v1.33.1-0.20220613153615-7f039c17be85 h1:D6daohskjSMGRbS2v4FT72vruV3PCGNVUFN4VyEIvx0= -github.com/pulumi/terraform-provider-spotinst v1.33.1-0.20220613153615-7f039c17be85/go.mod h1:FfRBM2p2OAZwLedaciLOriCavBrCkGHlMl0n0IVYdzI= +github.com/pulumi/terraform-provider-spotinst v1.33.1-0.20220627133113-a1bc6c524aae h1:Gl62oiOkZLfvj2EMLUEx7n7Yc/3F6uPKuP9qKRkbahw= +github.com/pulumi/terraform-provider-spotinst v1.33.1-0.20220627133113-a1bc6c524aae/go.mod h1:FfRBM2p2OAZwLedaciLOriCavBrCkGHlMl0n0IVYdzI= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8= diff --git a/sdk/go.mod b/sdk/go.mod index 024beb52..458d231e 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -1,9 +1,58 @@ module github.com/pulumi/pulumi-spotinst/sdk/v3 -go 1.14 +go 1.17 require ( github.com/blang/semver v3.5.1+incompatible github.com/pkg/errors v0.9.1 github.com/pulumi/pulumi/sdk/v3 v3.30.0 ) + +require ( + github.com/cheggaaa/pb v1.0.18 // indirect + github.com/djherbis/times v1.2.0 // indirect + github.com/emirpasic/gods v1.12.0 // indirect + github.com/gofrs/uuid v3.3.0+incompatible // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect + github.com/golang/protobuf v1.4.2 // indirect + github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect + github.com/hashicorp/errwrap v1.0.0 // indirect + github.com/hashicorp/go-multierror v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect + github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/mattn/go-runewidth v0.0.8 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mitchellh/go-ps v1.0.0 // indirect + github.com/opentracing/basictracer-go v1.0.0 // indirect + github.com/opentracing/opentracing-go v1.1.0 // indirect + github.com/pkg/term v1.1.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect + github.com/rogpeppe/go-internal v1.8.1 // indirect + github.com/sabhiram/go-gitignore v0.0.0-20180611051255-d3107576ba94 // indirect + github.com/sergi/go-diff v1.1.0 // indirect + github.com/spf13/cast v1.3.1 // indirect + github.com/spf13/cobra v1.4.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/src-d/gcfg v1.4.0 // indirect + github.com/texttheater/golang-levenshtein v0.0.0-20191208221605-eb6844b05fc6 // indirect + github.com/tweekmonster/luser v0.0.0-20161003172636-3fa38070dbd7 // indirect + github.com/uber/jaeger-client-go v2.22.1+incompatible // indirect + github.com/uber/jaeger-lib v2.2.0+incompatible // indirect + github.com/xanzy/ssh-agent v0.2.1 // indirect + go.uber.org/atomic v1.6.0 // indirect + golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect + golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect + golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2 // indirect + golang.org/x/text v0.3.3 // indirect + google.golang.org/genproto v0.0.0-20200608115520-7c474a2e3482 // indirect + google.golang.org/grpc v1.29.1 // indirect + google.golang.org/protobuf v1.24.0 // indirect + gopkg.in/src-d/go-billy.v4 v4.3.2 // indirect + gopkg.in/src-d/go-git.v4 v4.13.1 // indirect + gopkg.in/warnings.v0 v0.1.2 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 // indirect +) diff --git a/sdk/go.sum b/sdk/go.sum index 6ceeb772..c8b7035a 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -32,7 +32,6 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= @@ -92,8 +91,9 @@ github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+v github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-runewidth v0.0.8 h1:3tS41NlGYSmhhe/8fhGRzc+z3AYCw1Fe1WAyLuujKs0= github.com/mattn/go-runewidth v0.0.8/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -173,7 +173,6 @@ golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7 golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -206,6 +205,7 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2 h1:c8PlLMqBbOHoqtjteWm5/kbe6rNY2pbRfbIMVnepueo= golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=