From 0c9113cdad2173f4d24df4c2611968b917b88d44 Mon Sep 17 00:00:00 2001 From: AJ Date: Thu, 5 Dec 2024 16:30:42 +0000 Subject: [PATCH] fix #1478 we should copy the TF module into a temporary directory before running tests in parallel --- test/terraform_aws_rds_example_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/terraform_aws_rds_example_test.go b/test/terraform_aws_rds_example_test.go index efac235ea..7c704bbed 100644 --- a/test/terraform_aws_rds_example_test.go +++ b/test/terraform_aws_rds_example_test.go @@ -8,6 +8,7 @@ import ( "github.com/gruntwork-io/terratest/modules/aws" "github.com/gruntwork-io/terratest/modules/random" "github.com/gruntwork-io/terratest/modules/terraform" + test_structure "github.com/gruntwork-io/terratest/modules/test-structure" "github.com/stretchr/testify/assert" ) @@ -75,12 +76,13 @@ func TestTerraformAwsRdsExample(t *testing.T) { awsRegion := aws.GetRandomStableRegion(t, nil, nil) engineVersion := aws.GetValidEngineVersion(t, awsRegion, tt.engineName, tt.majorEngineVersion) instanceType := aws.GetRecommendedRdsInstanceType(t, awsRegion, tt.engineName, engineVersion, []string{"db.t2.micro", "db.t3.micro", "db.t3.small"}) + moduleFolder := test_structure.CopyTerraformFolderToTemp(t, "../", "examples/terraform-aws-rds-example") // Construct the terraform options with default retryable errors to handle the most common retryable errors in // terraform testing. terraformOptions := terraform.WithDefaultRetryableErrors(t, &terraform.Options{ // The path to where our Terraform code is located - TerraformDir: "../examples/terraform-aws-rds-example", + TerraformDir: moduleFolder, // Variables to pass to our Terraform code using -var options // "username" and "password" should not be passed from here in a production scenario.