From 9a70deb4ee2095caa53f466d7a344d8a787515b5 Mon Sep 17 00:00:00 2001 From: jem Date: Mon, 23 Mar 2020 17:44:32 +0100 Subject: [PATCH] respect auto approve --- build.py | 2 +- src/main/python/ddadevops/devops_terraform_build.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/build.py b/build.py index efa2700..ca49c95 100644 --- a/build.py +++ b/build.py @@ -28,7 +28,7 @@ use_plugin("python.distutils") default_task = "publish" 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" description = __doc__ authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")] diff --git a/src/main/python/ddadevops/devops_terraform_build.py b/src/main/python/ddadevops/devops_terraform_build.py index 515f1c6..6a0c731 100644 --- a/src/main/python/ddadevops/devops_terraform_build.py +++ b/src/main/python/ddadevops/devops_terraform_build.py @@ -103,15 +103,17 @@ class DevopsTerraformBuild(DevopsBuild): def apply(self, p_auto_approve=False): tf = self.init_client() self.print_terraform_command('apply') - kwargs = {"auto-approve": p_auto_approve} - tf.apply(capture_output=False, var=self.project_vars(),**kwargs) + tf.apply(capture_output=False, var=self.project_vars(),skip_plan=p_auto_approve) self.write_output(tf) def destroy(self, p_auto_approve=False): tf = self.init_client() self.print_terraform_command('destroy') - kwargs = {"auto-approve": p_auto_approve} - tf.destroy(capture_output=False, var=self.project_vars(),**kwargs) + if p_auto_approve: + 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,): tf = self.init_client()