Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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