Skip to content

Commit

Permalink
feat: Add terraform validate support (#747)
Browse files Browse the repository at this point in the history
* feat: Add terraform validate support

* Fixed test cases
  • Loading branch information
alexlokshin-czi authored Oct 5, 2022
1 parent 49e1c05 commit 068cc00
Show file tree
Hide file tree
Showing 28 changed files with 112 additions and 0 deletions.
4 changes: 4 additions & 0 deletions templates/templates/repo/scripts/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ fmt: terraform ## format code in this component
$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## validate code in this component
$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

lint: lint-terraform-fmt lint-tflint ## run all linters for this component
.PHONY: lint

Expand Down
4 changes: 4 additions & 0 deletions templates/templates/repo/scripts/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ fmt: terraform ## run terraform fmt on this module
@$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## run terraform validate on this module
@$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

check: lint check-docs ## run all checks on this module
.PHONY: check

Expand Down
4 changes: 4 additions & 0 deletions testdata/auth0_provider_yaml/scripts/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ fmt: terraform ## format code in this component
$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## validate code in this component
$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

lint: lint-terraform-fmt lint-tflint ## run all linters for this component
.PHONY: lint

Expand Down
4 changes: 4 additions & 0 deletions testdata/auth0_provider_yaml/scripts/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ fmt: terraform ## run terraform fmt on this module
@$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## run terraform validate on this module
@$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

check: lint check-docs ## run all checks on this module
.PHONY: check

Expand Down
4 changes: 4 additions & 0 deletions testdata/bless_provider_yaml/scripts/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ fmt: terraform ## format code in this component
$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## validate code in this component
$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

lint: lint-terraform-fmt lint-tflint ## run all linters for this component
.PHONY: lint

Expand Down
4 changes: 4 additions & 0 deletions testdata/bless_provider_yaml/scripts/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ fmt: terraform ## run terraform fmt on this module
@$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## run terraform validate on this module
@$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

check: lint check-docs ## run all checks on this module
.PHONY: check

Expand Down
4 changes: 4 additions & 0 deletions testdata/circleci/scripts/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ fmt: terraform ## format code in this component
$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## validate code in this component
$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

lint: lint-terraform-fmt lint-tflint ## run all linters for this component
.PHONY: lint

Expand Down
4 changes: 4 additions & 0 deletions testdata/circleci/scripts/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ fmt: terraform ## run terraform fmt on this module
@$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## run terraform validate on this module
@$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

check: lint check-docs ## run all checks on this module
.PHONY: check

Expand Down
4 changes: 4 additions & 0 deletions testdata/github_actions/scripts/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ fmt: terraform ## format code in this component
$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## validate code in this component
$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

lint: lint-terraform-fmt lint-tflint ## run all linters for this component
.PHONY: lint

Expand Down
4 changes: 4 additions & 0 deletions testdata/github_actions/scripts/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ fmt: terraform ## run terraform fmt on this module
@$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## run terraform validate on this module
@$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

check: lint check-docs ## run all checks on this module
.PHONY: check

Expand Down
4 changes: 4 additions & 0 deletions testdata/github_provider_yaml/scripts/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ fmt: terraform ## format code in this component
$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## validate code in this component
$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

lint: lint-terraform-fmt lint-tflint ## run all linters for this component
.PHONY: lint

Expand Down
4 changes: 4 additions & 0 deletions testdata/github_provider_yaml/scripts/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ fmt: terraform ## run terraform fmt on this module
@$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## run terraform validate on this module
@$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

check: lint check-docs ## run all checks on this module
.PHONY: check

Expand Down
4 changes: 4 additions & 0 deletions testdata/okta_provider_yaml/scripts/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ fmt: terraform ## format code in this component
$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## validate code in this component
$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

lint: lint-terraform-fmt lint-tflint ## run all linters for this component
.PHONY: lint

Expand Down
4 changes: 4 additions & 0 deletions testdata/okta_provider_yaml/scripts/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ fmt: terraform ## run terraform fmt on this module
@$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## run terraform validate on this module
@$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

check: lint check-docs ## run all checks on this module
.PHONY: check

Expand Down
4 changes: 4 additions & 0 deletions testdata/remote_backend_yaml/scripts/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ fmt: terraform ## format code in this component
$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## validate code in this component
$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

lint: lint-terraform-fmt lint-tflint ## run all linters for this component
.PHONY: lint

Expand Down
4 changes: 4 additions & 0 deletions testdata/remote_backend_yaml/scripts/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ fmt: terraform ## run terraform fmt on this module
@$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## run terraform validate on this module
@$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

check: lint check-docs ## run all checks on this module
.PHONY: check

Expand Down
4 changes: 4 additions & 0 deletions testdata/snowflake_provider_yaml/scripts/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ fmt: terraform ## format code in this component
$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## validate code in this component
$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

lint: lint-terraform-fmt lint-tflint ## run all linters for this component
.PHONY: lint

Expand Down
4 changes: 4 additions & 0 deletions testdata/snowflake_provider_yaml/scripts/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ fmt: terraform ## run terraform fmt on this module
@$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## run terraform validate on this module
@$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

check: lint check-docs ## run all checks on this module
.PHONY: check

Expand Down
4 changes: 4 additions & 0 deletions testdata/tfe_config/scripts/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ fmt: terraform ## format code in this component
$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## validate code in this component
$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

lint: lint-terraform-fmt lint-tflint ## run all linters for this component
.PHONY: lint

Expand Down
4 changes: 4 additions & 0 deletions testdata/tfe_config/scripts/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ fmt: terraform ## run terraform fmt on this module
@$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## run terraform validate on this module
@$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

check: lint check-docs ## run all checks on this module
.PHONY: check

Expand Down
4 changes: 4 additions & 0 deletions testdata/tfe_provider_yaml/scripts/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ fmt: terraform ## format code in this component
$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## validate code in this component
$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

lint: lint-terraform-fmt lint-tflint ## run all linters for this component
.PHONY: lint

Expand Down
4 changes: 4 additions & 0 deletions testdata/tfe_provider_yaml/scripts/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ fmt: terraform ## run terraform fmt on this module
@$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## run terraform validate on this module
@$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

check: lint check-docs ## run all checks on this module
.PHONY: check

Expand Down
4 changes: 4 additions & 0 deletions testdata/v2_full_yaml/scripts/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ fmt: terraform ## format code in this component
$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## validate code in this component
$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

lint: lint-terraform-fmt lint-tflint ## run all linters for this component
.PHONY: lint

Expand Down
4 changes: 4 additions & 0 deletions testdata/v2_full_yaml/scripts/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ fmt: terraform ## run terraform fmt on this module
@$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## run terraform validate on this module
@$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

check: lint check-docs ## run all checks on this module
.PHONY: check

Expand Down
4 changes: 4 additions & 0 deletions testdata/v2_minimal_valid_yaml/scripts/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ fmt: terraform ## format code in this component
$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## validate code in this component
$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

lint: lint-terraform-fmt lint-tflint ## run all linters for this component
.PHONY: lint

Expand Down
4 changes: 4 additions & 0 deletions testdata/v2_minimal_valid_yaml/scripts/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ fmt: terraform ## run terraform fmt on this module
@$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## run terraform validate on this module
@$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

check: lint check-docs ## run all checks on this module
.PHONY: check

Expand Down
4 changes: 4 additions & 0 deletions testdata/v2_no_aws_provider_yaml/scripts/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ fmt: terraform ## format code in this component
$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## validate code in this component
$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

lint: lint-terraform-fmt lint-tflint ## run all linters for this component
.PHONY: lint

Expand Down
4 changes: 4 additions & 0 deletions testdata/v2_no_aws_provider_yaml/scripts/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ fmt: terraform ## run terraform fmt on this module
@$(terraform_command) fmt $(TF_ARGS)
.PHONY: fmt

validate: terraform ## run terraform validate on this module
@$(terraform_command) validate $(TF_ARGS)
.PHONY: validate

check: lint check-docs ## run all checks on this module
.PHONY: check

Expand Down

0 comments on commit 068cc00

Please sign in to comment.