Terraform validate命令显示帮助,而不是在GitLab CI上执行

时间:2019-03-02 12:30:34

标签: gitlab terraform

我正在GitLab上创建Terraform管道,并且尝试运行“ terraform validate”命令,但是由于某些原因而不是执行该命令,而是显示了它的帮助页面。

以下是配置项执行的日志

Running with gitlab-runner 11.8.0 (4745a6f3)
  on docker-auto-scale 0277ea0f
Using Docker executor with image hashicorp/terraform:light ...
Pulling docker image hashicorp/terraform:light ...
Using docker image sha256:29edcab3b90b2c0c3140744166fae4e7a2381d76981c16af06c04d77e5a4920d for hashicorp/terraform:light ...
Running on runner-0277ea0f-project-11103224-concurrent-0 via runner-0277ea0f-srm-1551527982-01159ca1...
Cloning repository...
Cloning into '/builds/brpaz/terraform-boilerplate'...
Checking out 1e6820c7 as master...
Skipping Git submodules setup
$ rm -rf .terraform
$ terraform --version
Terraform v0.11.11

$ terraform init

Initializing provider plugins...
- Checking for available provider plugins on https://releases.hashicorp.com...
- Downloading plugin for provider "digitalocean" (1.1.0)...

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.

* provider.digitalocean: version = "~> 1.1"

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
$ echo "do_token = $DO_TOKEN" >> terraform.tfvars
$ terraform validate
Usage: terraform validate [options] [dir]

  Validate the terraform files in a directory. Validation includes a
  basic check of syntax as well as checking that all variables declared
  in the configuration are specified in one of the possible ways:

      -var foo=...
      -var-file=foo.vars
      TF_VAR_foo environment variable
      terraform.tfvars
      default value

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

Options:

  -check-variables=true If set to true (default), the command will check
                        whether all required variables have been specified.

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

  -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" is present, it will be
                        automatically loaded if this flag is not specified.
ERROR: Job failed: exit code 1

如果我在不使用args的情况下在本地运行“ terraform validate”,则效果很好。我可以很好地运行其他terraform命令,并且正在使用“ hashicorp / terraform:light”泊坞窗映像。

有任何线索吗?

谢谢。

0 个答案:

没有答案