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

feat: add support for terraform console -plan #151

Merged
merged 1 commit into from
Sep 9, 2024
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
10 changes: 9 additions & 1 deletion terrabutler/click.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,23 @@ def tf_apply_cli(ctx, auto_approve, destroy, input, lock, lock_timeout,
"interactive command prompt")
@click.option("-state", help="Legacy option for the local backend only."
" See the local backend's documentation for more information.")
@click.option("-plan", is_flag=True, default=False,
help="Create a new plan (as if running \"terraform plan\") and"
" then evaluate expressions against its planned state,"
" instead of evaluating against the current state."
" You can use this to inspect the effects of configuration"
" changes that haven't been applied yet..")
@click.option("-var", multiple=True,
help="Set a variable in the Terraform configuration. "
"This flag can be set multiple times.")
@click.pass_context
def tf_console_cli(ctx, state, var):
def tf_console_cli(ctx, state, plan, var):
options = []

if state:
options.append(f"-state={state}")
if plan:
options.append("-plan")
if var:
for name in var:
options.append(f"-var='{name}'")
Expand Down