How to use the tftest.__init__.TerraformOutputs function in tftest

To help you get started, we’ve selected a few tftest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GoogleCloudPlatform / terraform-python-testing-helper / tftest / __init__.py View on Github external
def output(self, name=None, color=False, json_format=True):
    """Run Terraform output command."""
    cmd_args = []
    if name:
      cmd_args.append(name)
    cmd_args += parse_args(color=color, json_format=json_format)
    output = self.execute_command('output', *cmd_args).out
    _LOGGER.debug('output %s', output)
    if json_format:
      try:
        output = TerraformOutputs(json.loads(output))
      except json.JSONDecodeError as e:
        _LOGGER.warn('error decoding output: {}'.format(e))
    self.last_output = output
    return output
github GoogleCloudPlatform / terraform-python-testing-helper / tftest / __init__.py View on Github external
def __init__(self, path, raw):
    self._raw = raw
    self.path = path
    self.outputs = TerraformOutputs(raw['outputs'])
    self.depends_on = raw['depends_on']
    # key type provider attributes depends_on
    self.resources = {}
    for k, v in raw['resources'].items():
      self.resources[k] = TerraformStateResource(
          k, v['provider'], v['type'],
          v.get('primary', {}).get('attributes', {}), v['depends_on'], v)
github GoogleCloudPlatform / terraform-python-testing-helper / tftest / __init__.py View on Github external
def __init__(self, raw):
    super(TerraformOutputs, self).__init__(raw)
    self.sensitive = tuple(k for k, v in raw.items() if v.get('sensitive'))