Skip to content

Commit

Permalink
✨ : make destroy jobs upload their plan
Browse files Browse the repository at this point in the history
  • Loading branch information
juwit committed Jun 9, 2021
1 parent cc447e1 commit 21f17ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/io/gaia_app/runner/RunnerCommandBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ String buildApplyScript(Job job, Stack stack, TerraformModule module) {
* @return
*/
String buildPlanDestroyScript(Job job, Stack stack, TerraformModule module) {
return buildScript(job, stack, module, "terraform plan -destroy -detailed-exitcode", false);
return buildScript(job, stack, module, "terraform plan -out plan.binary -destroy -detailed-exitcode", true);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ void buildPlanDestroyScript_shouldGenerateAFullScript() {
assertTrue(script.contains("echo '[gaia] generating backend configuration'"));
assertTrue(script.contains("terraform version"));
assertTrue(script.contains("terraform init"));
assertTrue(script.contains("terraform plan -destroy"));
assertTrue(script.contains("terraform plan -out plan.binary -destroy"));
assertTrue(script.contains("terraform show -json plan.binary > plan.json"));
}

@Test
Expand All @@ -204,7 +205,8 @@ void buildPlanDestroyScript_shouldGenerateAFullScript_forAModuleWithoutDirectory
assertTrue(script.contains("echo '[gaia] generating backend configuration'"));
assertTrue(script.contains("terraform version"));
assertTrue(script.contains("terraform init"));
assertTrue(script.contains("terraform plan -destroy"));
assertTrue(script.contains("terraform plan -out plan.binary -destroy"));
assertTrue(script.contains("terraform show -json plan.binary > plan.json"));
}

@Test
Expand All @@ -226,7 +228,8 @@ void buildPlanDestroyScript_shouldGenerateAFullScript_forAModuleWithAccessToken(
assertTrue(script.contains("echo '[gaia] generating backend configuration'"));
assertTrue(script.contains("terraform version"));
assertTrue(script.contains("terraform init"));
assertTrue(script.contains("terraform plan -destroy"));
assertTrue(script.contains("terraform plan -out plan.binary -destroy"));
assertTrue(script.contains("terraform show -json plan.binary > plan.json"));
}


Expand Down

0 comments on commit 21f17ed

Please sign in to comment.