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

Add CI job for linting + validating Terraform #292

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mvandenburgh
Copy link
Member

uses: hashicorp/setup-terraform@v3

- name: Lint Terraform code
run: terraform fmt -check -diff -recursive
Copy link
Contributor

@brianhelba brianhelba Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why -diff?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It renders a diff of the required changes when linting fails. I guess it would provide more immediate feedback in the CI display when linting fails, although I suppose the utility of that is debatable since you'd be fixing the issues via terraform fmt, not manually.

I don't have strong feelings on including this or not, I just left it in when I copied the command from DANDI.

Copy link
Contributor

@brianhelba brianhelba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mvandenburgh Thanks for the idea. I'm still trying to determine how much value the terraform validate provides, given that for a deployed application, terraform plan will also be run against real infrastructure.

I want to do a little more research, then I'll have a stronger opinion about how much CI we should have for TF.

Copy link
Contributor

@brianhelba brianhelba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mvandenburgh Thanks for the idea. I'm still trying to determine how much value the terraform validate provides, given that for a deployed application, terraform plan will also be run against real infrastructure.

I want to do a little more research, then I'll have a stronger opinion about how much CI we should have for TF.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants