-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #260 from kmanning/issue_88
Issue 88: hold off on DESTROY decoration and Strategies
- Loading branch information
Showing
22 changed files
with
294 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,38 @@ | ||
class DestroyPlugin implements TerraformEnvironmentStagePlugin { | ||
class DestroyPlugin implements TerraformPlanCommandPlugin, | ||
TerraformApplyCommandPlugin { | ||
|
||
private static arguments = [] | ||
public static DESTROY_CONFIRM_MESSAGE = 'WARNING! Are you absolutely sure the plan above is correct? Your environment will be IMMEDIATELY DESTROYED via "terraform destroy"' | ||
public static DESTROY_OK_MESSAGE = "Run terraform DESTROY now" | ||
|
||
public static void init() { | ||
DestroyPlugin plugin = new DestroyPlugin() | ||
|
||
ConfirmApplyPlugin.withConfirmMessage('WARNING! Are you absolutely sure the plan above is correct? Your environment will be IMMEDIATELY DESTROYED via "terraform destroy"') | ||
ConfirmApplyPlugin.withOkMessage("Run terraform DESTROY now") | ||
ConfirmApplyPlugin.withConfirmMessage(DESTROY_CONFIRM_MESSAGE) | ||
ConfirmApplyPlugin.withOkMessage(DESTROY_OK_MESSAGE) | ||
TerraformEnvironmentStage.withStageNamePattern { options -> "${options['command']}-DESTROY-${options['environment']}" } | ||
|
||
TerraformEnvironmentStage.addPlugin(plugin) | ||
TerraformPlanCommand.addPlugin(plugin) | ||
TerraformApplyCommand.addPlugin(plugin) | ||
} | ||
|
||
public void apply(TerraformPlanCommand command) { | ||
command.withArgument('-destroy') | ||
} | ||
|
||
public void apply(TerraformApplyCommand command) { | ||
command.withCommand('destroy') | ||
for (arg in arguments) { | ||
command.withArgument(arg) | ||
} | ||
} | ||
|
||
public static withArgument(String arg) { | ||
arguments << arg | ||
return this | ||
} | ||
|
||
@Override | ||
public void apply(TerraformEnvironmentStage stage) { | ||
stage.withStrategy(new DestroyStrategy(arguments)) | ||
public static reset() { | ||
arguments = [] | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.