gruntwork-io / pre-commit

A collection of pre-commit hooks used by Gruntwork tools
https://gruntwork.io/
Apache License 2.0
494 stars 157 forks source link

terraform-validate breaks after 0.1.5 #31

Closed guidodobboletta closed 4 years ago

guidodobboletta commented 4 years ago

Execution of hook in 0.1.5

Terraform validate.......................................................Failed
- hook id: terraform-validate
- exit code: 1

Initializing modules...

Initializing provider plugins...
- Checking for available provider plugins...
- Downloading plugin for provider "null" (hashicorp/null) 2.1.2...
- Downloading plugin for provider "aws" (hashicorp/aws) 2.65.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.null: version = "~> 2.1"
* provider.template: version = "~> 2.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.

Error: Error in function call

  on terraform/modules/nsqd/data.tf line 2, in data "template_file" "opt_nsqd_etc_nsqd_config":
   2:   template = file(
   3: 
   4: 
    |----------------
    | path.module is "terraform/modules/nsqd"

Call to function "file" failed: no file exists at
terraform/templates/nsqd/nsqd_config.tpl.

Execution of hook in 0.1.8

Terraform validate.......................................................Failed
- hook id: terraform-validate
- exit code: 1

Terraform initialized in an empty directory!

The directory has no Terraform configuration files. You may begin working
with Terraform immediately by creating Terraform configuration files.

Error: Failed to read module directory

Module directory terraform does not exist or cannot be read.

Directory structure:

tree -L 2                                                                                                                                                    
.
├── README.md
└── terraform
    ├── bin
    ├── config
    ├── main.tf
    ├── Makefile
    ├── modules
    ├── templates
    ├── variables.tf
    └── versions.tf
yorinasub17 commented 4 years ago

Does 0.1.8 work for you?

guidodobboletta commented 4 years ago

It does not. It fails with the message I posted above:

Terraform validate.......................................................Failed
- hook id: terraform-validate
- exit code: 1

Terraform initialized in an empty directory!

The directory has no Terraform configuration files. You may begin working
with Terraform immediately by creating Terraform configuration files.

Error: Failed to read module directory

Module directory terraform does not exist or cannot be read.
yorinasub17 commented 4 years ago

@guidodobboletta Thanks for confirming and apologies for the delay in getting back to you. This should now be fixed in https://github.com/gruntwork-io/pre-commit/releases/tag/v0.1.9