Add plan with a fail-on-diff option.

- on exception, exit script with exit code > 0
This commit is contained in:
niels.knacke+quietschenetchen@neuland-bfi.de 2020-07-06 10:19:32 +02:00
parent 51f07bbc78
commit cf0a195efb

View file

@ -148,11 +148,13 @@ class DevopsTerraformBuild(DevopsBuild):
def plan_fail_on_diff(self): def plan_fail_on_diff(self):
tf = self.init_client() tf = self.init_client()
tf.plan(detailed_exitcode=IsFlagged, capture_output=False, raise_on_error=False, return_code = tf.plan(detailed_exitcode=IsFlagged, capture_output=False, raise_on_error=False,
var=self.project_vars(), var=self.project_vars(),
var_file=self.additional_tfvar_files) var_file=self.additional_tfvar_files)
self.post_build() self.post_build()
self.print_terraform_command(tf) self.print_terraform_command(tf)
if (return_code > 0):
sys.exit(return_code)
def apply(self, auto_approve=False): def apply(self, auto_approve=False):