Skip to content

hook terraform validate fails  #203

Closed
@loque1

Description

@loque1

Hi. I upgraded to terraform 0.15.4 and the terraform_validate hook fails with the following

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

Validation failed: iac/common
╷
│ Warning: Experimental feature "module_variable_optional_attrs" is active
│ 
│   on terraform.tf line 13, in terraform:
│   13:   experiments = [module_variable_optional_attrs]
│ 
│ Experimental features are subject to breaking changes in future minor or
│ patch releases, based on feedback.
│ 
│ If you have feedback on the design of this feature, please open a GitHub
│ issue to discuss it.
╵
╷
│ Error: Could not load plugin
│ 
│ 
│ Plugin reinitialization required. Please run "terraform init".
│ 
│ Plugins are external binaries that Terraform uses to access and manipulate
│ resources. The configuration provided requires plugins which can't be
│ located,
│ don't satisfy the version constraints, or are otherwise incompatible.
│ 
│ Terraform automatically discovers provider requirements from your
│ configuration, including providers used in child modules. To see the
│ requirements and constraints, run "terraform providers".
│ 
│ 2 problems:
│ 
│ - failed to instantiate provider "registry.terraform.io/hashicorp/azuread"
│ to obtain schema: unknown provider
│ "registry.terraform.io/hashicorp/azuread"
│ - failed to instantiate provider "registry.terraform.io/hashicorp/azurerm"
│ to obtain schema: unknown provider
│ "registry.terraform.io/hashicorp/azurerm"
│ 
╵

If I run the command outside of pre-commit in the same directory it all passes fine

╷
│ Warning: Experimental feature "module_variable_optional_attrs" is active
│ 
│   on terraform.tf line 13, in terraform:
│   13:   experiments = [module_variable_optional_attrs]
│ 
│ Experimental features are subject to breaking changes in future minor or patch releases, based on feedback.
│ 
│ If you have feedback on the design of this feature, please open a GitHub issue to discuss it.
│ 
│ (and 5 more similar warnings elsewhere)
╵
Success! The configuration is valid, but there were some validation warnings as shown above.

Any help on this would be ideal

Metadata

Metadata

Assignees

Labels

bug_with_workaroundSomething isn't working but there is a workarounddocumentationImprovements or additions to documentationestimate/1hNeed 1 hour to be donehook/terraform_validateBash hookwontfixThis will not be worked on

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions