-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to Terraform 0.15 #1651
Update to Terraform 0.15 #1651
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test runs Terragrunt first with a local backend and then with an S3 backend. Unfortunately, with TF 0.15, when you switch to the S3 backend, it shows an interactive prompt asking if you want to migrate state over from the local backend. This interactive prompt now causes the test to fail. I tried switching the second Terragrunt run from Not sure how this worked before 0.15, but as per @yorinasub17's comment here, this test doesn't quite test what we are looking for anyway, and give the complexity of working around an interactive prompt, I opted to remove it. |
||
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)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test case and the one below look like the copy/pasted the logic from |
||
|
||
// 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) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Terraform's help text is a bit different now, so had to update this test accordingly.