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

fix: install deps for pre-commit #36

Merged
merged 4 commits into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,28 @@ jobs:
- uses: actions/checkout@v4
- name: install pre-commit
run: pip install pre-commit

- name: Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.5.7"

- name: install hcledit
run: |
curl -sSLo ./hcledit.tar.gz https://github.com/minamijoyo/hcledit/releases/download/v0.2.10/hcledit_0.2.10_linux_amd64.tar.gz
tar -xzf hcledit.tar.gz
chmod +x hcledit
mv hcledit /usr/local/bin/hcledit

- name: install tf-lint
run: curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash

- name: install tf-docs
run: |
curl -sSLo ./terraform-docs.tar.gz https://terraform-docs.io/dl/v0.17.0/terraform-docs-v0.17.0-linux-amd64.tar.gz
tar -xzf terraform-docs.tar.gz
chmod +x terraform-docs
mv terraform-docs /usr/local/bin/terraform-docs

- name: pre-commit
run: pre-commit run --all-files --show-diff-on-failure
30 changes: 15 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ repos:
hooks:
- id: terraform_fmt
- id: terraform_wrapper_module_for_each
# - id: terraform_validate
- id: terraform_validate
- id: terraform_docs
args:
- '--args=--lockfile=false'
- id: terraform_tflint
# args:
# - '--args=--only=terraform_deprecated_interpolation'
# - '--args=--only=terraform_deprecated_index'
# - '--args=--only=terraform_unused_declarations'
# - '--args=--only=terraform_comment_syntax'
# - '--args=--only=terraform_documented_outputs'
# - '--args=--only=terraform_documented_variables'
# - '--args=--only=terraform_typed_variables'
# - '--args=--only=terraform_module_pinned_source'
# - '--args=--only=terraform_naming_convention'
# - '--args=--only=terraform_required_version'
# - '--args=--only=terraform_required_providers'
# - '--args=--only=terraform_standard_module_structure'
# - '--args=--only=terraform_workspace_remote'
args:
- '--args=--only=terraform_deprecated_interpolation'
- '--args=--only=terraform_deprecated_index'
- '--args=--only=terraform_unused_declarations'
- '--args=--only=terraform_comment_syntax'
- '--args=--only=terraform_documented_outputs'
- '--args=--only=terraform_documented_variables'
- '--args=--only=terraform_typed_variables'
- '--args=--only=terraform_module_pinned_source'
- '--args=--only=terraform_naming_convention'
- '--args=--only=terraform_required_version'
- '--args=--only=terraform_required_providers'
- '--args=--only=terraform_standard_module_structure'
- '--args=--only=terraform_workspace_remote'
5 changes: 1 addition & 4 deletions terraform/example/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ provider "aws" {
region = "us-west-2"
}
data "aws_caller_identity" "current" {}
output "account_id" {
value = data.aws_caller_identity.current.account_id
}
resource "aws_ebs_encryption_by_default" "us_west_2" {
enabled = true
}
Expand Down Expand Up @@ -163,7 +160,7 @@ module "karpenter" {
node_iam_role_additional_policies = {
AmazonSSMManagedInstanceCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
}
// TODO: get a better naming conventions for roles
# TODO: get a better naming conventions for roles
node_iam_role_name = "KarpenterNodeRole-${local.core_cluster_name}"
iam_role_name = "${local.core_cluster_name}-karpenter-role"
iam_role_use_name_prefix = false
Expand Down
5 changes: 5 additions & 0 deletions terraform/example/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
output "account_id" {
description = "sample account id"
value = data.aws_caller_identity.current.account_id

}
10 changes: 6 additions & 4 deletions terraform/example/variables.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
variable "owner" {
default = "pelotech"
type = string
description = "owner tags which get added to the resources"
default = "pelotech"
type = string
}
variable "environment" {
default = "production"
type = string
description = "environment tags which get added to the resources"
default = "production"
type = string
}