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

0.12-alpha: The help message of terraform validate suggests terraform plan -validate-only, but it has not been implemented yet #19259

Closed
minamijoyo opened this issue Nov 2, 2018 · 2 comments · Fixed by #20467
Milestone

Comments

@minamijoyo
Copy link
Contributor

Hi there,
I found a minor problem with v0.12-alpha2.

The help message of terraform validate suggests terraform plan -validate-only, but it has not been implemented yet.

Is this feature included in the scope of v0.12.0 final?
If not, this help message will confuse users.

Terraform Version

$ ./terraform version
Terraform v0.12.0-alpha2

Expected Behavior

terraform plan -validate-only should work as described in help
or terraform validate --help should not show this message.

Actual Behavior

$ ./terraform validate --help
Usage: terraform validate [options] [dir]

  Validate the configuration files in a directory, referring only to the
  configuration and not accessing any remote services such as remote state,
  provider APIs, etc.

  Validate runs checks that verify whether a configuration is
  internally-consistent, regardless of any provided variables or existing
  state. It is thus primarily useful for general verification of reusable
  modules, including correctness of attribute names and value types.

  To verify configuration in the context of a particular run (a particular
  target workspace, operation variables, etc), use the following command
  instead:
      terraform plan -validate-only

  It is safe to run this command automatically, for example as a post-save
  check in a text editor or as a test step for a re-usable module in a CI
  system.

  Validation requires an initialized working directory with any referenced
  plugins and modules installed. To initialize a working directory for
  validation without accessing any configured remote backend, use:
      terraform init -backend=false

  If dir is not specified, then the current directory will be used.

Options:

  -json        Produce output in a machine-readable JSON format, suitable for
               use in e.g. text editor integrations.

  -no-color    If specified, output won't contain any color.
$ ./terraform plan -validate-only
Usage: terraform plan [options] [DIR-OR-PLAN]

  Generates an execution plan for Terraform.

  This execution plan can be reviewed prior to running apply to get a
  sense for what Terraform will do. Optionally, the plan can be saved to
  a Terraform plan file, and apply can take this plan file to execute
  this plan exactly.

  If a saved plan is passed as an argument, this command will output
  the saved plan contents. It will not modify the given plan.

Options:

  -destroy            If set, a plan will be generated to destroy all resources
                      managed by the given configuration and state.

  -detailed-exitcode  Return detailed exit codes when the command exits. This
                      will change the meaning of exit codes to:
                      0 - Succeeded, diff is empty (no changes)
                      1 - Errored
                      2 - Succeeded, there is a diff

  -input=true         Ask for input for variables if not directly set.

  -lock=true          Lock the state file when locking is supported.

  -lock-timeout=0s    Duration to retry a state lock.

  -module-depth=n     Specifies the depth of modules to show in the output.
                      This does not affect the plan itself, only the output
                      shown. By default, this is -1, which will expand all.

  -no-color           If specified, output won't contain any color.

  -out=path           Write a plan file to the given path. This can be used as
                      input to the "apply" command.

  -parallelism=n      Limit the number of concurrent operations. Defaults to 10.

  -refresh=true       Update state prior to checking for differences.

  -state=statefile    Path to a Terraform state file to use to look
                      up Terraform-managed resources. By default it will
                      use the state "terraform.tfstate" if it exists.

  -target=resource    Resource to target. Operation will be limited to this
                      resource and its dependencies. This flag can be used
                      multiple times.

  -var 'foo=bar'      Set a variable in the Terraform configuration. This
                      flag can be set multiple times.

  -var-file=foo       Set variables in the Terraform configuration from
                      a file. If "terraform.tfvars" or any ".auto.tfvars"
                      files are present, they will be automatically loaded.

Steps to Reproduce

Run terraform validate --help

References

Related to: #17539

@apparentlymart apparentlymart added this to the v0.12.0 milestone Nov 2, 2018
@apparentlymart
Copy link
Contributor

Thanks for pointing this out, @minamijoyo!

Indeed we changed some plans here during development and added the new terraform validate behavior to the v0.12 scope (because it turned out that the old terraform validate behaviors were no longer compatible with other refactoring) but didn't include the terraform plan -validate-only yet.

I've added this issue to the v0.12.0 milestone but we will see depending on how much time other work takes whether we will implement it as implied by these help messages or just remove it from the help messages for now and leave terraform plan -validate-only for a later release.

@ghost
Copy link

ghost commented Mar 29, 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 Mar 29, 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.

2 participants