def terraform_init(self, init_spec): name = init_spec['name'] wd = init_spec['wd'] tf = Terraform(working_dir=wd) return_code, stdout, stderr = tf.init() error = self.check_output(name, 'init', return_code, stdout, stderr) if error: raise TerraformCommandError( return_code, 'init', out=stdout, err=stderr) return name, tf
def terraform_output(self, spec): name = spec['name'] tf = spec['tf'] return_code, stdout, stderr = tf.output_cmd(json=IsFlagged) error = self.check_output(name, 'output', return_code, stdout, stderr) no_output_error = \ 'The module root could not be found. There is nothing to output.' if error: if no_output_error in stderr: stdout = '{}' else: raise TerraformCommandError( return_code, 'output', out=stdout, err=stderr) return name, json.loads(stdout)