How to use the tftest.__init__.TerraformState 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 __init__(self, raw):
    super(TerraformState, self).__init__(raw)
    self.modules = {}
    for k, v in raw.items():
      if k != 'modules':
        setattr(self, k, v)
        continue
      for mod in v:
        path = '.'.join(mod['path'])
        self.modules[path] = TerraformStateModule(path, mod)
github GoogleCloudPlatform / terraform-python-testing-helper / tftest / __init__.py View on Github external
def state_pull(self):
    """Pull state."""
    state = self.execute_command('state', 'pull')
    try:
      self.last_state = TerraformState(json.loads(state.out))
    except json.JSONDecodeError as e:
      _LOGGER.warn('error decoding state: {}'.format(e))
    return self.last_state