Skip to content

Commit

Permalink
chore: use temp folder for terratest
Browse files Browse the repository at this point in the history
  • Loading branch information
johncblandii committed Jul 28, 2020
1 parent 64ea058 commit c9b77a2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/src/examples_complete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@ import (
"testing"

"github.com/gruntwork-io/terratest/modules/terraform"
test_structure "github.com/gruntwork-io/terratest/modules/test-structure"
"github.com/stretchr/testify/assert"
)

// Test the Terraform module in examples/complete using Terratest.
func TestExamplesComplete(t *testing.T) {
t.Parallel()

rootFolder := "../../"
terraformFolderRelativeToRoot := "examples/complete"
tempTestFolder := test_structure.CopyTerraformFolderToTemp(t, rootFolder, terraformFolderRelativeToRoot)

terraformOptions := &terraform.Options{
// The path to where our Terraform code is located
TerraformDir: "../../examples/complete",
TerraformDir: tempTestFolder,
Upgrade: true,
// Variables to pass to our Terraform code using -var-file options
VarFiles: []string{"fixtures.us-west-1.tfvars"},
Expand Down Expand Up @@ -44,9 +49,13 @@ func TestExamplesComplete(t *testing.T) {
func TestExamplesCompleteWithGrants(t *testing.T) {
t.Parallel()

rootFolder := "../../"
terraformFolderRelativeToRoot := "examples/complete"
tempTestFolder := test_structure.CopyTerraformFolderToTemp(t, rootFolder, terraformFolderRelativeToRoot)

terraformOptions := &terraform.Options{
// The path to where our Terraform code is located
TerraformDir: "../../examples/complete",
TerraformDir: tempTestFolder,
Upgrade: true,
// Variables to pass to our Terraform code using -var-file options
VarFiles: []string{"grants.us-west-1.tfvars"},
Expand Down

0 comments on commit c9b77a2

Please sign in to comment.