diff --git a/.circleci/config.yml b/.circleci/config.yml index 4d46699ff5..30b7f6cb32 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,6 @@ defaults: &defaults docker: - - image: 087285199408.dkr.ecr.us-east-1.amazonaws.com/circle-ci-test-image-base:go1.16-tf14.4-tg28.8 + - image: 087285199408.dkr.ecr.us-east-1.amazonaws.com/circle-ci-test-image-base:go1.16-tf15.0-tg28.24 version: 2 jobs: diff --git a/cli/args_test.go b/cli/args_test.go index 157782620d..199bad0150 100644 --- a/cli/args_test.go +++ b/cli/args_test.go @@ -6,6 +6,7 @@ import ( "io/ioutil" "os" "path/filepath" + "regexp" "testing" "strings" @@ -373,18 +374,19 @@ func TestTerraformHelp(t *testing.T) { args []string expected string }{ - {[]string{"terragrunt", "plan", "--help"}, "Usage: terraform plan"}, - {[]string{"terragrunt", "apply", "-help"}, "Usage: terraform apply"}, - {[]string{"terragrunt", "apply", "-h"}, "Usage: terraform apply"}, + {[]string{"terragrunt", "plan", "--help"}, "Usage: terraform .* plan"}, + {[]string{"terragrunt", "apply", "-help"}, "Usage: terraform .* apply"}, + {[]string{"terragrunt", "apply", "-h"}, "Usage: terraform .* apply"}, } for _, testCase := range testCases { err := app.Run(testCase.args) + require.NoError(t, err) + expectedRegex, err := regexp.Compile(testCase.expected) require.NoError(t, err) - if !strings.Contains(output.String(), testCase.expected) { - t.Errorf("expected output to include help text; got stdout: %v.", output.String()) - } + + assert.Regexp(t, expectedRegex, output.String()) } } diff --git a/docs/_docs/01_getting-started/supported-terraform-versions.md b/docs/_docs/01_getting-started/supported-terraform-versions.md index 91a02b78f4..128e451f52 100644 --- a/docs/_docs/01_getting-started/supported-terraform-versions.md +++ b/docs/_docs/01_getting-started/supported-terraform-versions.md @@ -15,6 +15,7 @@ The officially supported versions are: | Terraform Version | Terragrunt Version | |-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------| +| 0.15.x | >= [0.29.0](https://github.com/gruntwork-io/terragrunt/releases/tag/v0.29.0) | | 0.14.x | >= [0.27.0](https://github.com/gruntwork-io/terragrunt/releases/tag/v0.27.0) | | 0.13.x | >= [0.25.0](https://github.com/gruntwork-io/terragrunt/releases/tag/v0.25.0) | | 0.12.x | [0.19.0](https://github.com/gruntwork-io/terragrunt/releases/tag/v0.19.0) - [0.24.4](https://github.com/gruntwork-io/terragrunt/releases/tag/v0.24.4) | diff --git a/test/fixture-regressions/accesslogging-bucket/no-target-prefix-input/local_terragrunt.hcl b/test/fixture-regressions/accesslogging-bucket/no-target-prefix-input/local_terragrunt.hcl deleted file mode 100644 index bb7b160deb..0000000000 --- a/test/fixture-regressions/accesslogging-bucket/no-target-prefix-input/local_terragrunt.hcl +++ /dev/null @@ -1 +0,0 @@ -# Intentionally empty diff --git a/test/fixture-regressions/accesslogging-bucket/with-target-prefix-input/local_terragrunt.hcl b/test/fixture-regressions/accesslogging-bucket/with-target-prefix-input/local_terragrunt.hcl deleted file mode 100644 index bb7b160deb..0000000000 --- a/test/fixture-regressions/accesslogging-bucket/with-target-prefix-input/local_terragrunt.hcl +++ /dev/null @@ -1 +0,0 @@ -# Intentionally empty diff --git a/test/integration_test.go b/test/integration_test.go index cb9976574f..938aa0e4f3 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -522,44 +522,6 @@ func TestTerragruntWorksWithLocalTerraformVersion(t *testing.T) { validateDynamoDBTableExistsAndIsTagged(t, TERRAFORM_REMOTE_STATE_S3_REGION, lockTableName, expectedDynamoDBTableTags) } -// Regression test to ensure that skip flags associated with the S3 bucket autocreation feature. At one point, -// terragrunt was stripping the flags in a way that it was no longer being honored. -// This bug only happens if terragrunt calls remotestate.NeedsInitialization on the s3 initializer, so we need to setup -// a situation where terragrunt calls this. To do this, we first setup the module with local backend (so that -// moduleNeedsInit is false), before switching to the remote backend. -func TestTerragruntHonorsS3RemoteStateSkipFlagsRegression(t *testing.T) { - t.Parallel() - - examplePath := filepath.Join(TEST_FIXTURE_REGRESSIONS, "skip-versioning") - cleanupTerraformFolder(t, examplePath) - // Also clean up generated backend file - removeFile(t, filepath.Join(examplePath, "backend.tf")) - - s3BucketName := fmt.Sprintf("terragrunt-test-bucket-%s", strings.ToLower(uniqueId())) - lockTableName := fmt.Sprintf("terragrunt-test-locks-%s", strings.ToLower(uniqueId())) - - defer deleteS3Bucket(t, TERRAFORM_REMOTE_STATE_S3_REGION, s3BucketName) - defer cleanupTableForTest(t, lockTableName, TERRAFORM_REMOTE_STATE_S3_REGION) - - tmpTerragruntConfigPath := createTmpTerragruntConfig( - t, - examplePath, - s3BucketName, - lockTableName, - "remote_terragrunt.hcl", - ) - localBackendTerragruntConfigPath := filepath.Join(examplePath, "local_terragrunt.hcl") - - // Pass 1 with local backend. This should only download and setup the terragrunt-cache. Note that the first pass has - // to be an apply so that the state file is created. Otherwise, terragrunt short circuits the problematic routine. - runTerragrunt(t, fmt.Sprintf("terragrunt apply -auto-approve --terragrunt-non-interactive --terragrunt-config %s --terragrunt-working-dir %s", localBackendTerragruntConfigPath, examplePath)) - - // Pass 2 with remote backend. This should setup the remote backend and create the s3 bucket. - runTerragrunt(t, fmt.Sprintf("terragrunt validate --terragrunt-non-interactive --terragrunt-config %s --terragrunt-working-dir %s", tmpTerragruntConfigPath, examplePath)) - versioningStatus := terraws.GetS3BucketVersioning(t, TERRAFORM_REMOTE_STATE_S3_REGION, s3BucketName) - assert.NotEqual(t, versioningStatus, "Enabled") -} - // Regression test to ensure that `accesslogging_bucket_name` and `accesslogging_target_prefix` are taken into account // & the TargetLogs bucket is set to a new S3 bucket, different from the origin S3 bucket // & the logs objects are prefixed with the `accesslogging_target_prefix` value @@ -568,8 +530,6 @@ func TestTerragruntSetsAccessLoggingForTfSTateS3BuckeToADifferentBucketWithGiven examplePath := filepath.Join(TEST_FIXTURE_REGRESSIONS, "accesslogging-bucket/with-target-prefix-input") cleanupTerraformFolder(t, examplePath) - // Also clean up generated backend file - removeFile(t, filepath.Join(examplePath, "backend.tf")) s3BucketName := fmt.Sprintf("terragrunt-test-bucket-%s", strings.ToLower(uniqueId())) s3BucketLogsName := fmt.Sprintf("%s-tf-state-logs", s3BucketName) @@ -586,13 +546,7 @@ func TestTerragruntSetsAccessLoggingForTfSTateS3BuckeToADifferentBucketWithGiven lockTableName, "remote_terragrunt.hcl", ) - localBackendTerragruntConfigPath := filepath.Join(examplePath, "local_terragrunt.hcl") - - // Pass 1 with local backend. This should only download and setup the terragrunt-cache. Note that the first pass has - // to be an apply so that the state file is created. Otherwise, terragrunt short circuits the problematic routine. - runTerragrunt(t, fmt.Sprintf("terragrunt apply -auto-approve --terragrunt-non-interactive --terragrunt-config %s --terragrunt-working-dir %s", localBackendTerragruntConfigPath, examplePath)) - // Pass 2 with remote backend. This should setup the remote backend and create the s3 bucket. runTerragrunt(t, fmt.Sprintf("terragrunt validate --terragrunt-non-interactive --terragrunt-config %s --terragrunt-working-dir %s", tmpTerragruntConfigPath, examplePath)) targetLoggingBucket := terraws.GetS3BucketLoggingTarget(t, TERRAFORM_REMOTE_STATE_S3_REGION, s3BucketName) @@ -609,8 +563,6 @@ func TestTerragruntSetsAccessLoggingForTfSTateS3BuckeToADifferentBucketWithDefau examplePath := filepath.Join(TEST_FIXTURE_REGRESSIONS, "accesslogging-bucket/no-target-prefix-input") cleanupTerraformFolder(t, examplePath) - // Also clean up generated backend file - removeFile(t, filepath.Join(examplePath, "backend.tf")) s3BucketName := fmt.Sprintf("terragrunt-test-bucket-%s", strings.ToLower(uniqueId())) s3BucketLogsName := fmt.Sprintf("%s-tf-state-logs", s3BucketName) @@ -626,13 +578,7 @@ func TestTerragruntSetsAccessLoggingForTfSTateS3BuckeToADifferentBucketWithDefau lockTableName, "remote_terragrunt.hcl", ) - localBackendTerragruntConfigPath := filepath.Join(examplePath, "local_terragrunt.hcl") - - // Pass 1 with local backend. This should only download and setup the terragrunt-cache. Note that the first pass has - // to be an apply so that the state file is created. Otherwise, terragrunt short circuits the problematic routine. - runTerragrunt(t, fmt.Sprintf("terragrunt apply -auto-approve --terragrunt-non-interactive --terragrunt-config %s --terragrunt-working-dir %s", localBackendTerragruntConfigPath, examplePath)) - // Pass 2 with remote backend. This should setup the remote backend and create the s3 bucket. runTerragrunt(t, fmt.Sprintf("terragrunt validate --terragrunt-non-interactive --terragrunt-config %s --terragrunt-working-dir %s", tmpTerragruntConfigPath, examplePath)) targetLoggingBucket := terraws.GetS3BucketLoggingTarget(t, TERRAFORM_REMOTE_STATE_S3_REGION, s3BucketName)