Skip to content

Commit d8cac81

Browse files
committed
test(external): add simple test with init and validate
1 parent 7830ece commit d8cac81

File tree

3 files changed

+140
-2
lines changed

3 files changed

+140
-2
lines changed

test/external_test.go

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/gruntwork-io/terratest/modules/terraform"
7+
test_structure "github.com/gruntwork-io/terratest/modules/test-structure"
8+
)
9+
10+
func TestTerraformExternal(t *testing.T) {
11+
t.Parallel()
12+
13+
// Make a copy of the terraform module to a temporary directory. This allows running multiple tests in parallel
14+
// against the same terraform module.
15+
exampleFolder := test_structure.CopyTerraformFolderToTemp(t, "../external", ".")
16+
17+
terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{
18+
TerraformDir: exampleFolder,
19+
})
20+
21+
terraform.Init(t, terraformOptions)
22+
terraform.Validate(t, terraformOptions)
23+
}

test/go.mod

+29
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ require github.com/gruntwork-io/terratest v0.40.18
66

77
require (
88
cloud.google.com/go v0.83.0 // indirect
9+
cloud.google.com/go/storage v1.10.0 // indirect
10+
github.com/agext/levenshtein v1.2.3 // indirect
11+
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
912
github.com/aws/aws-sdk-go v1.40.56 // indirect
13+
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
1014
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
1115
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
1216
github.com/davecgh/go-spew v1.1.1 // indirect
@@ -15,19 +19,33 @@ require (
1519
github.com/go-logr/logr v0.2.0 // indirect
1620
github.com/go-sql-driver/mysql v1.4.1 // indirect
1721
github.com/gogo/protobuf v1.3.2 // indirect
22+
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
1823
github.com/golang/protobuf v1.5.2 // indirect
24+
github.com/golang/snappy v0.0.3 // indirect
1925
github.com/google/go-cmp v0.5.7 // indirect
2026
github.com/google/gofuzz v1.1.0 // indirect
2127
github.com/google/uuid v1.2.0 // indirect
28+
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
2229
github.com/googleapis/gnostic v0.4.1 // indirect
2330
github.com/gruntwork-io/go-commons v0.8.0 // indirect
2431
github.com/hashicorp/errwrap v1.0.0 // indirect
32+
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
33+
github.com/hashicorp/go-getter v1.6.1 // indirect
2534
github.com/hashicorp/go-multierror v1.1.0 // indirect
35+
github.com/hashicorp/go-safetemp v1.0.0 // indirect
36+
github.com/hashicorp/go-version v1.3.0 // indirect
37+
github.com/hashicorp/hcl/v2 v2.9.1 // indirect
38+
github.com/hashicorp/terraform-json v0.13.0 // indirect
2639
github.com/imdario/mergo v0.3.11 // indirect
40+
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a // indirect
2741
github.com/jmespath/go-jmespath v0.4.0 // indirect
2842
github.com/json-iterator/go v1.1.11 // indirect
43+
github.com/jstemmer/go-junit-report v0.9.1 // indirect
44+
github.com/klauspost/compress v1.13.0 // indirect
2945
github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326 // indirect
3046
github.com/mitchellh/go-homedir v1.1.0 // indirect
47+
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
48+
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
3149
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
3250
github.com/modern-go/reflect2 v1.0.1 // indirect
3351
github.com/pkg/errors v0.9.1 // indirect
@@ -36,15 +54,26 @@ require (
3654
github.com/russross/blackfriday/v2 v2.1.0 // indirect
3755
github.com/spf13/pflag v1.0.5 // indirect
3856
github.com/stretchr/testify v1.8.0 // indirect
57+
github.com/tmccombs/hcl2json v0.3.3 // indirect
58+
github.com/ulikunitz/xz v0.5.8 // indirect
3959
github.com/urfave/cli v1.22.2 // indirect
60+
github.com/zclconf/go-cty v1.9.1 // indirect
61+
go.opencensus.io v0.23.0 // indirect
4062
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
63+
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
64+
golang.org/x/mod v0.4.2 // indirect
4165
golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect
4266
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c // indirect
4367
golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e // indirect
4468
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
4569
golang.org/x/text v0.3.6 // indirect
4670
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
71+
golang.org/x/tools v0.1.2 // indirect
72+
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
73+
google.golang.org/api v0.47.0 // indirect
4774
google.golang.org/appengine v1.6.7 // indirect
75+
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect
76+
google.golang.org/grpc v1.38.0 // indirect
4877
google.golang.org/protobuf v1.26.0 // indirect
4978
gopkg.in/inf.v0 v0.9.1 // indirect
5079
gopkg.in/yaml.v2 v2.4.0 // indirect

0 commit comments

Comments
 (0)