Skip to content

Commit b30defe

Browse files
committed
Add Terraform installer for cross-platform
1 parent 2e1f4fd commit b30defe

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require (
1010
github.com/golang-migrate/migrate/v4 v4.15.1
1111
github.com/google/uuid v1.3.0
1212
github.com/hashicorp/go-version v1.3.0
13+
github.com/hashicorp/hc-install v0.3.1
1314
github.com/hashicorp/terraform-config-inspect v0.0.0-20211115214459-90acf1ca460f
1415
github.com/hashicorp/terraform-exec v0.15.0
1516
github.com/lib/pq v1.10.4
@@ -52,7 +53,8 @@ require (
5253
github.com/google/go-cmp v0.5.6 // indirect
5354
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
5455
github.com/hashicorp/errwrap v1.0.0 // indirect
55-
github.com/hashicorp/go-multierror v1.1.0 // indirect
56+
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
57+
github.com/hashicorp/go-multierror v1.1.1 // indirect
5658
github.com/hashicorp/hcl v1.0.0 // indirect
5759
github.com/hashicorp/hcl/v2 v2.0.0 // indirect
5860
github.com/hashicorp/terraform-json v0.13.0 // indirect

go.sum

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,8 +616,9 @@ github.com/hashicorp/go-getter v1.5.3 h1:NF5+zOlQegim+w/EUhSLh6QhXHmZMEeHLQzllkQ
616616
github.com/hashicorp/go-getter v1.5.3/go.mod h1:BrrV/1clo8cCYu6mxvboYg+KutTiFnXjMEgDD8+i7ZI=
617617
github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I=
618618
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
619-
github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI=
620619
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
620+
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
621+
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
621622
github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo=
622623
github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I=
623624
github.com/hashicorp/go-uuid v1.0.0 h1:RS8zrF7PhGwyNPOtxSClXXj9HA8feRnJzgnI1RJCSnM=
@@ -627,6 +628,8 @@ github.com/hashicorp/go-version v1.3.0 h1:McDWVJIU/y+u1BRV06dPaLfLCaT7fUTJLp5r04
627628
github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
628629
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
629630
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
631+
github.com/hashicorp/hc-install v0.3.1 h1:VIjllE6KyAI1A244G8kTaHXy+TL5/XYzvrtFi8po/Yk=
632+
github.com/hashicorp/hc-install v0.3.1/go.mod h1:3LCdWcCDS1gaHC9mhHCGbkYfoY6vdsKohGjugbZdZak=
630633
github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w=
631634
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
632635
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
@@ -1158,6 +1161,7 @@ golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPh
11581161
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
11591162
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
11601163
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
1164+
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
11611165
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
11621166
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
11631167
golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 h1:/pEO3GD/ABYAjuakUS6xSEmmlyVS4kxBNkeA9tLJiTI=

provisioner/terraform/provision_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,24 @@ import (
99

1010
"github.com/coder/coder/provisionersdk"
1111
"github.com/coder/coder/provisionersdk/proto"
12+
"github.com/hashicorp/go-version"
1213
"github.com/stretchr/testify/require"
1314
"storj.io/drpc/drpcconn"
15+
16+
"github.com/hashicorp/hc-install/product"
17+
"github.com/hashicorp/hc-install/releases"
1418
)
1519

1620
func TestProvision(t *testing.T) {
1721
t.Parallel()
1822

23+
installer := &releases.ExactVersion{
24+
Product: product.Terraform,
25+
Version: version.Must(version.NewVersion("1.1.2")),
26+
}
27+
execPath, err := installer.Install(context.Background())
28+
require.NoError(t, err)
29+
1930
client, server := provisionersdk.TransportPipe()
2031
ctx, cancelFunc := context.WithCancel(context.Background())
2132
t.Cleanup(func() {
@@ -28,6 +39,7 @@ func TestProvision(t *testing.T) {
2839
ServeOptions: &provisionersdk.ServeOptions{
2940
Transport: server,
3041
},
42+
BinaryPath: execPath,
3143
})
3244
require.NoError(t, err)
3345
}()

0 commit comments

Comments
 (0)