Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"terraform-validate", "terraform-fmt" fails with "command not found" in Linux-based systems due to ^M carriage return character #65

Open
MarioArriaga92 opened this issue Dec 31, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@MarioArriaga92
Copy link

Describe the bug
"pre-commit run terraform-validate --all-files" command fails until I follow Remove the spurious CR characters steps to use sed to remove "The ^M is a carriage return character":
Screen Shot 2021-12-31 at 15 42 29

To Reproduce
Steps to reproduce the behavior including the relevant Terraform/Terragrunt/Packer version number and any code snippets and module inputs you used.

  1. Install pre-commit in Mac OS or some linux flavor OS (Ubuntu, etc.) & create a .pre-commit-config.yaml as defined in Pre-commit README.md > General Usage
  2. Run pre-commit run terraform-validate --all-files
  3. See failures, now run sed -i -e 's/\r$//' /Users/arriaga/.cache/pre-commit/repo57cjvft5/hooks/terraform-validate.sh
  4. Re-try pre-commit run terraform-validate --all-files and see how errors g oaway

Expected behavior
Maybe pre-commit hooks should avoid having the "^M" carriage return character?

Additional context
Tried to follow "Step 3 - Static Analysis" steps of Getting Started with Terraform on Azure: Testing blog article

@MarioArriaga92 MarioArriaga92 added the bug Something isn't working label Dec 31, 2021
@MarioArriaga92
Copy link
Author

Any update?

@infraredgirl
Copy link
Contributor

Hi Mario, thanks for the bug report! It looks like you've already figured out the fix - would you mind submitting a quick PR?

@dsalaj
Copy link

dsalaj commented Jan 27, 2022

I have the same issue with terraform-fmt in pre-commit v0.1.17. The solution of @MarioArriaga92 worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants