Wythe Lin 2017-08-01 17:51:12 -07:00
parent b1d1efac12
commit f7691f7d3c

View file

@ -35,7 +35,7 @@ class Terraform(object):
var_file=None, var_file=None,
terraform_bin_path=None, terraform_bin_path=None,
is_env_vars_included=True): is_env_vars_included=True):
""" """
:param working_dir: the folder of the working folder, if not given, :param working_dir: the folder of the working folder, if not given,
will be current working folder will be current working folder
:param targets: list of target :param targets: list of target
@ -49,7 +49,7 @@ class Terraform(object):
could be string or list, list stands for multiple -var-file option could be string or list, list stands for multiple -var-file option
:param terraform_bin_path: binary path of terraform :param terraform_bin_path: binary path of terraform
:type is_env_vars_included: bool :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.is_env_vars_included = is_env_vars_included
self.working_dir = working_dir self.working_dir = working_dir
@ -250,13 +250,19 @@ class Terraform(object):
else: else:
return ret_code, None, None return ret_code, None, None
def output(self, name): def output(self, name, **kwargs):
""" """
https://www.terraform.io/docs/commands/output.html https://www.terraform.io/docs/commands/output.html
:param name: name of output :param name: name of output
:return: output value :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)) log.debug('output raw string: {0}'.format(out))
if ret != 0: if ret != 0: