Skip to content

Validate & linting doesn't work for projects with sub-directories #87

Description

@zacharyabresch

I'm sad to be posting this because I've been struggling for days to get these simple pre-commit hooks to work. So far, the only one I've actually gotten functional is terraform_fmt. I'm aware of #59 but there's been no response there since October of 2019. Here are some details:

terraform_validate

Fails with several errors:

  • Error: Module not installed
  • Error: provider.aws: no suitable version installed
  • Error: Could not satisfy plugin requirements

All of these are basically indicating the same thing, init has not been run in the sub-directory. There are a few problems with this:

  1. init has indeed been run in each of these sub-directories but the pre-commit hook (or perhaps Terraform) doesn't seem to be aware
  2. Running terraform validate from the project root directory succeeds without error

What is the pre-commit hook doing that the CLI command isn't (or vice-versa)?

terraform_tflint

I see several variations of the following error:

  • ERROR: unable to resolve endpoint for service "ecs", region "", err: UnknownEndpointError: could not resolve endpoint (replace ecs with any other service we're using)
  • also: Error: An error occurred while invoking DescribeSecurityGroups; MissingRegion: could not find region configuration

Now, running tflint --deep --module returns one error (the first one detailed above) so this is also probably an issue with that tool but ... is no one else using sub-directories? I find that incredibly hard to believe.

So, in the end, the only pre-commit hook I've gotten to work is terraform_fmt. Kind of disappointing as I've been extolling the value of validating & linting but am unable to deliver a working MVP to prove it due to the above problems.

Has anyone experienced these pains? Are there any workarounds or fixes for the above issues? Any advice at all? Thanks for your time & effort.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions