respect auto approve

This commit is contained in:
jem 2020-03-23 17:44:32 +01:00
parent 95aaccb647
commit 9a70deb4ee
2 changed files with 7 additions and 5 deletions

View file

@ -28,7 +28,7 @@ use_plugin("python.distutils")
default_task = "publish" default_task = "publish"
name = "ddadevops" name = "ddadevops"
version = "0.4.2.dev0" version = "0.4.2.dev1"
summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud" summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud"
description = __doc__ description = __doc__
authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")] authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")]

View file

@ -103,15 +103,17 @@ class DevopsTerraformBuild(DevopsBuild):
def apply(self, p_auto_approve=False): def apply(self, p_auto_approve=False):
tf = self.init_client() tf = self.init_client()
self.print_terraform_command('apply') self.print_terraform_command('apply')
kwargs = {"auto-approve": p_auto_approve} tf.apply(capture_output=False, var=self.project_vars(),skip_plan=p_auto_approve)
tf.apply(capture_output=False, var=self.project_vars(),**kwargs)
self.write_output(tf) self.write_output(tf)
def destroy(self, p_auto_approve=False): def destroy(self, p_auto_approve=False):
tf = self.init_client() tf = self.init_client()
self.print_terraform_command('destroy') self.print_terraform_command('destroy')
kwargs = {"auto-approve": p_auto_approve} if p_auto_approve:
tf.destroy(capture_output=False, var=self.project_vars(),**kwargs) force=IsFlagged
else:
force=None
tf.destroy(capture_output=False, force=force, var=self.project_vars())
def tf_import(self, tf_import_name, tf_import_resource,): def tf_import(self, tf_import_name, tf_import_resource,):
tf = self.init_client() tf = self.init_client()