From e47d3fe232ae3df859d0fd6be52c0c2da862d016 Mon Sep 17 00:00:00 2001 From: Ahmad Musa <53178237+ahmadiesa-abu@users.noreply.github.com> Date: Mon, 3 Oct 2022 17:23:27 +0300 Subject: [PATCH] CYBL-1834-Fix-Passing-Varaibles-TFSec (#219) --- CHANGELOG.txt | 2 ++ cloudify_tf/terraform/__init__.py | 5 ++++- cloudify_tf/terraform/tfsec.py | 5 ++++- plugin.yaml | 2 +- plugin_1_4.yaml | 2 +- v2_plugin.yaml | 2 +- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 8d7e5c9..a2fe7c8 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,5 @@ +0.19.8: + - Pass the variables file to tfsec correctly. 0.19.7: - Bump SDK to fix an issue with get_environment_capability. 0.19.6: diff --git a/cloudify_tf/terraform/__init__.py b/cloudify_tf/terraform/__init__.py index c6098c1..5fe22d8 100644 --- a/cloudify_tf/terraform/__init__.py +++ b/cloudify_tf/terraform/__init__.py @@ -617,7 +617,10 @@ def check_tfsec(self): self.tfsec.terraform_root_module = self.root_module commands = [] with self.runtime_file(commands): - self.tfsec.tfsec() + # injecting another - to make the flag correct + if commands: + commands[0] = "-{0}".format(commands[0]) + self.tfsec.tfsec(commands) def run_terratag(self): if not self.terratag: diff --git a/cloudify_tf/terraform/tfsec.py b/cloudify_tf/terraform/tfsec.py index ac07e06..b6d25b3 100644 --- a/cloudify_tf/terraform/tfsec.py +++ b/cloudify_tf/terraform/tfsec.py @@ -169,13 +169,16 @@ def configfile(self): except Exception: raise - def tfsec(self): + def tfsec(self, command_extension=None): with self.configfile() as config_file: basic_commands = ['.', '--no-color', '--format', 'json'] if config_file: basic_commands.extend(['--config-file', config_file]) + if command_extension: + basic_commands.extend(command_extension) + command = self.merged_args(self.flags, basic_commands) command.insert(0, self.executable_path) return self.execute(command, self.terraform_root_module, self.env, diff --git a/plugin.yaml b/plugin.yaml index ac7d53f..b86ffb8 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -2,7 +2,7 @@ plugins: tf: executor: central_deployment_agent package_name: cloudify-terraform-plugin - package_version: '0.19.7' + package_version: '0.19.8' dsl_definitions: diff --git a/plugin_1_4.yaml b/plugin_1_4.yaml index 99bc692..46562d5 100644 --- a/plugin_1_4.yaml +++ b/plugin_1_4.yaml @@ -2,7 +2,7 @@ plugins: tf: executor: central_deployment_agent package_name: cloudify-terraform-plugin - package_version: '0.19.7' + package_version: '0.19.8' dsl_definitions: diff --git a/v2_plugin.yaml b/v2_plugin.yaml index 519efc6..9823272 100644 --- a/v2_plugin.yaml +++ b/v2_plugin.yaml @@ -2,7 +2,7 @@ plugins: tf: executor: central_deployment_agent package_name: cloudify-terraform-plugin - package_version: '0.19.7' + package_version: '0.19.8' dsl_definitions: