Skip to content

"terraform validate" should not fail on implicit provider config when provider arguments are required #21408

Closed
@plum117

Description

@plum117

I ran the command terraform validate -check-variables=false and I got the below output. It seems like the command is not well format.

However, when I run terraform validate then the command seems fine and I have the expected output : Error: Missing required argument. The argument "region" is required, but was not set.

Does the validate command actually changed since terraform validate --help do not show -check-variables=false as being a possible option. At the same time, the website seems saying otherwise: https://www.terraform.io/docs/commands/validate.html

Maybe the doc on the web site needs a small update. Thanks

terraform validate -check-variables=false
2019/05/23 10:32:07 [INFO] Terraform version: 0.12.0
2019/05/23 10:32:07 [INFO] Go runtime version: go1.12.4
2019/05/23 10:32:07 [INFO] CLI args: []string{"/home/dprevost/.local/bin/terraform", "validate", "-check-variables=false"}
2019/05/23 10:32:07 [DEBUG] Attempting to open CLI config file: /home/dprevost/.terraformrc
2019/05/23 10:32:07 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/05/23 10:32:07 [INFO] CLI command args: []string{"validate", "-check-variables=false"}
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.

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.

To verify configuration in the context of a particular run (a particular
target workspace, operation variables, etc), use the terraform plan
subcommand instead, which includes an implied validation check.

Options:

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions