def run_terraform(ctx, command, opts_list):
# Add state file location option
tf_state_file = '{0}/{1}'.format(ctx.terraform.dir, ctx.terraform.state)
option = '-state={0}'.format(tf_state_file)
opts_list.append(option)
# Build terraform command
opts = ' '.join(opts_list)
tf_dir = ctx.terraform.dir
terraform = 'terraform {0} {1} {2}'.format(command, opts, tf_dir)
result = run(terraform, hide=False, warn=True)
if result.ok:
list(ctx)
else:
print("\n" + "-> " + result.command + "\n")
print(result)
raise exceptions.Failure(result)
评论列表
文章目录