terraform을 잘 쓰기 위한 package (ftm, validate, lint, sec, docs, pre-commit)

2024. 10. 29. 18:43기타/terraform

728x90
SMALL
  • 개요
terraform을 잘 쓰고 안전하게 사용하기 위한 각종 플러그인들과 package를 mac 사용자 기준으로 정리 해봤다.

 

  • 대상 package
terraform fmt
terraform validate
tflint
tfsec
terraform_docs
pre commit

 

 

  • 설치방법
brew install tfsec
brew install tflint
brew install terraform-docs
brew install pre-commit

 

  • 사용법
$ git init
cat <<EOF > .pre-commit-config.yaml
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
  rev: v1.96.1
  hooks:
    - id: terraform_fmt
    - id: terraform_validata
    - id: terraform_ftlint
    - id: terraform_ftsec
    - id: terraform_docs
EOF

$ pre-commit run -a

 

  • 참고
https://developer.hashicorp.com/terraform/cli/commands/fmt
https://developer.hashicorp.com/terraform/cli/commands/validate
https://github.com/aquasecurity/tfsec
https://github.com/terraform-linters/tflint
https://github.com/antonbabenko/pre-commit-terraform
728x90
LIST