Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement opta apply #14

Merged
merged 1 commit into from
Jan 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
doit
  • Loading branch information
ankurd1 committed Jan 4, 2021
commit 0ab4c281d8d111580979dd7eb529efa1602c6e4a
13 changes: 13 additions & 0 deletions opta/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import os
import subprocess
from typing import Any

import click
import yaml
Expand All @@ -14,6 +16,17 @@ def cli() -> None:
pass


@cli.command()
@click.pass_context
@click.option("--inp", default="opta.yml", help="Opta config file")
@click.option("--out", default="main.tf.json", help="Generated tf file")
@click.option("--init", is_flag=True, default=False, help="Generate init tf file")
def apply(ctx: Any, inp: str, out: str, init: bool) -> None:
ctx.forward(gen)
subprocess.run(["terraform", "init"], check=True)
subprocess.run(["terraform", "apply"], check=True)


@cli.command()
@click.option("--inp", default="opta.yml", help="Opta config file")
@click.option("--out", default="main.tf.json", help="Generated tf file")
Expand Down