From c9b77a2e53e87dd53d9187aaefc7a113008b0b6d Mon Sep 17 00:00:00 2001 From: "John C. Bland II" Date: Tue, 28 Jul 2020 11:41:58 -0500 Subject: [PATCH] chore: use temp folder for terratest --- test/src/examples_complete_test.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/src/examples_complete_test.go b/test/src/examples_complete_test.go index 6050e26c..43c0871b 100644 --- a/test/src/examples_complete_test.go +++ b/test/src/examples_complete_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/gruntwork-io/terratest/modules/terraform" + test_structure "github.com/gruntwork-io/terratest/modules/test-structure" "github.com/stretchr/testify/assert" ) @@ -11,9 +12,13 @@ import ( 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"}, @@ -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"},