Fix Terraform scripts for Packet.net deployment

This commit is contained in:
Simon Sapin 2018-12-11 20:09:03 +01:00
parent 0619541004
commit 554ee4e59d
2 changed files with 8 additions and 3 deletions

View file

@ -26,9 +26,13 @@ def livelog():
files = win2016["secrets"]["files"]
assert all(f["encoding"] == "base64" for f in files)
files = {f.get("description"): f["content"] for f in files}
cert = files["SSL certificate for livelog"]
key = files["SSL key for livelog"]
return {
"livelog_cert": base64.b64decode(files["SSL certificate for livelog"]),
"livelog_key": base64.b64decode(files["SSL key for livelog"]),
"livelog_cert_base64": cert,
"livelog_key_base64": key,
"livelog_cert": base64.b64decode(cert),
"livelog_key": base64.b64decode(key),
"livelog_secret": win2016["secrets"]["generic-worker"]["config"]["livelogSecret"],
}

View file

@ -29,7 +29,8 @@ def main(*args):
env = dict(os.environ)
env["PACKET_AUTH_TOKEN"] = terraform_vars["packet_api_key"]
env.update({"TF_VAR_" + k: v for k, v in terraform_vars.items()})
sys.exit(subprocess.call(["terraform"] + list(args), env=env))
cwd = os.path.abspath(os.path.dirname(__file__))
sys.exit(subprocess.call(["terraform"] + list(args), env=env, cwd=cwd))
if __name__ == "__main__":