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

CLI subcommands prob #7983

Closed
robrankin opened this issue Aug 4, 2016 · 3 comments · Fixed by #8199
Closed

CLI subcommands prob #7983

robrankin opened this issue Aug 4, 2016 · 3 comments · Fixed by #8199
Assignees

Comments

@robrankin
Copy link
Contributor

Terraform subcommands with parameters will still run if theres a space missing. Example:

terraform destroy-target=<module>

Space missing between destroy and -target=<module>

You'd expect this to error out, but instead:

[robrankin@host]$ terraform destroy-target=<module>
Do you really want to destroy?
  Terraform will delete all your managed infrastructure.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

If you don't look carefully you can miss the fact that its going to destroy all the resources, not just the module targeted.

If you then tell it yes, it will proceed to nuke the world.

Terraform Version

Terraform v0.7.0-dev (bad37a57cbea29d96753750bf95f23241f520681)

Affected Resource(s)

Subcommands

Terraform Configuration Files

N/A

Debug Output

N/A

Panic Output

N/A

Expected Behavior

Terraform should have exited as the command line params/subcommand was incorrect, as it was missing a space between the destroy subcommand and -target parameters

Actual Behavior

Terraform proceeded to destroy all resources in the current state.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform destroy-target=<module>

Important Factoids

N/A

References

N/A

@kwilczynski
Copy link
Contributor

This has indeed changed from 0.6.x to 0.7.x, as per:

  • v0.6.16
$ /usr/local/bin/terraform version123
usage: terraform [--version] [--help] <command> [<args>]

Available commands are:
    apply       Builds or changes infrastructure
    destroy     Destroy Terraform-managed infrastructure
    fmt         Rewrites config files to canonical format
    get         Download and install modules for the configuration
    graph       Create a visual graph of Terraform resources
    init        Initializes Terraform configuration from a module
    output      Read an output from a state file
    plan        Generate and show an execution plan
    push        Upload this Terraform module to Atlas to run
    refresh     Update local state file against real resources
    remote      Configure remote state storage
    show        Inspect Terraform state or plan
    taint       Manually mark a resource for recreation
    untaint     Manually unmark a resource as tainted
    validate    Validates the Terraform files
    version     Prints the Terraform version
  • v0.7.0 (from master)
$ ./pkg/darwin_amd64/terraform version123
Terraform v0.7.0-dev (6d927a40db1f46dd7d840d884af9ce8d7ec14931+CHANGES)

Your version of Terraform is out of date! The latest version
is 0.7.0. You can update by downloading from www.terraform.io

@mitchellh
Copy link
Contributor

Fixed here: mitchellh/cli#40

Once reviewed and merged will update the deps for Terraform and will be fixed.

mitchellh added a commit that referenced this issue Aug 15, 2016
mitchellh added a commit that referenced this issue Aug 15, 2016
kwilczynski pushed a commit to kwilczynski/terraform that referenced this issue Aug 18, 2016
@ghost
Copy link

ghost commented Apr 23, 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 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants