From f7691f7d3c083cbf6033726569315d030dca28f5 Mon Sep 17 00:00:00 2001 From: Wythe Lin Date: Tue, 1 Aug 2017 17:51:12 -0700 Subject: [PATCH] fix https://github.com/beelit94/python-terraform/issues/12 --- python_terraform/__init__.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/python_terraform/__init__.py b/python_terraform/__init__.py index 896d2e0..f1141c4 100644 --- a/python_terraform/__init__.py +++ b/python_terraform/__init__.py @@ -35,7 +35,7 @@ class Terraform(object): var_file=None, terraform_bin_path=None, is_env_vars_included=True): - """ + """ :param working_dir: the folder of the working folder, if not given, will be current working folder :param targets: list of target @@ -49,7 +49,7 @@ class Terraform(object): could be string or list, list stands for multiple -var-file option :param terraform_bin_path: binary path of terraform :type is_env_vars_included: bool - :param is_env_vars_included: included env variables when calling terraform cmd + :param is_env_vars_included: included env variables when calling terraform cmd """ self.is_env_vars_included = is_env_vars_included self.working_dir = working_dir @@ -250,13 +250,19 @@ class Terraform(object): else: return ret_code, None, None - def output(self, name): + def output(self, name, **kwargs): """ https://www.terraform.io/docs/commands/output.html :param name: name of output :return: output value """ - ret, out, err = self.cmd('output', name, json=IsFlagged) + options = kwargs + options['detailed_exitcode'] = detailed_exitcode + options = self._generate_default_options(options) + args = self._generate_default_args(dir_or_plan) + + ret, out, err = self.cmd( + 'output', name, json=IsFlagged, *args, **options) log.debug('output raw string: {0}'.format(out)) if ret != 0: