From cbad95707f29e74120f2eb55813e570cf151e4ea Mon Sep 17 00:00:00 2001 From: jem Date: Fri, 25 Jun 2021 11:54:32 +0200 Subject: [PATCH] add refresh --- src/main/python/ddadevops/devops_terraform_build.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/python/ddadevops/devops_terraform_build.py b/src/main/python/ddadevops/devops_terraform_build.py index 891118b..8d5b1dc 100644 --- a/src/main/python/ddadevops/devops_terraform_build.py +++ b/src/main/python/ddadevops/devops_terraform_build.py @@ -172,6 +172,19 @@ class DevopsTerraformBuild(DevopsBuild): if (return_code > 0): raise Exception(return_code, "terraform error:", stderr) + def refresh(self, auto_approve=True): + tf = self.init_client() + return_code, stdout, stderr = tf.apply(capture_output=False, raise_on_error=True, + refresh_only=IsFlagged, + skip_plan=auto_approve, + var=self.project_vars(), + var_file=self.additional_tfvar_files) + self.write_output(tf) + self.post_build() + self.print_terraform_command(tf) + if (return_code > 0): + raise Exception(return_code, "terraform error:", stderr) + def destroy(self, auto_approve=False): tf = self.init_client() if auto_approve: