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

Request standardization for terraform destroy and apply arguments #17385

Closed
unacceptable opened this issue Feb 18, 2018 · 3 comments
Closed

Request standardization for terraform destroy and apply arguments #17385

unacceptable opened this issue Feb 18, 2018 · 3 comments

Comments

@unacceptable
Copy link
Contributor

Terraform Version

14:06 MacOS: Terraform/ $ terraform --version
Terraform v0.11.3
+ provider.aws v1.6.0
+ provider.null v1.0.0

14:06 MacOS: Terraform/ $

Terraform Configuration Files

This is not applicable

Debug Output

This is not applicable

Crash Output

This is not applicable

Expected Behavior

It would be nice if -y was aliased for -force for terraform destroy and -auto-approve for terraform apply

Actual Behavior

14:05 MacOS: Terraform/ $ terraform apply -y
flag provided but not defined: -y
Usage: terraform apply [options] [DIR-OR-PLAN]

  Builds or changes infrastructure according to Terraform configuration
  files in DIR.

  By default, apply scans the current directory for the configuration
  and applies the changes appropriately. However, a path to another
  configuration or an execution plan can be provided. Execution plans can be
  used to only execute a pre-determined set of actions.

Options:
... (removed for readability)
14:06 MacOS: Terraform/ $ 

Steps to Reproduce

terraform apply -y
or
terraform destroy -y

Additional Context

I think that this would help developers in Staging and Development environments that can be stood up and torn down multiple times.

@unacceptable
Copy link
Contributor Author

This is not so much an issue as it is a feature request. Sorry if I put this in the wrong place.

@apparentlymart
Copy link
Member

Hi @ScriptMyJob! Thanks for this feature request.

Over in #17218 there is a change to make -auto-approve work on both terraform apply and terraform destroy.

We intentionally chose a very explicit name for this option because it's a dangerous option that should generally be used only in automation scenarios (where length of typing is not an issue). We don't want to have a single-character flag for something this dangerous.

The recommended workflow for interactive use is to type yes at the interactive prompt. I understand that this can be inconvenient if you are very rapidly creating an destroying a low-value environment, but Terraform's primary workflow designed with the common case of a high-value environment in mind.

If you have a codebase that has a workflow of frequent creating and destroy, I'd suggest optimizing that specific workflow with a codebase-specific wrapper script (or Makefile, etc) that includes the -auto-approve option. By including it in the relevant codebase you'd ensure that it can't be accidentally applied to a higher-value environment.

The current inconsistency between -force and -auto-approve will be addressed once #17218 is merged. I hope my rationale here for not implementing -y makes sense. Since we already have that PR open, I'm going to close this just to consolidate. Thanks again for opening this.

@ghost
Copy link

ghost commented Apr 4, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants