Skip to content

Commit

Permalink
Init the state
Browse files Browse the repository at this point in the history
  • Loading branch information
ognif committed Nov 19, 2024
1 parent a7a7a20 commit bc06eea
Show file tree
Hide file tree
Showing 69 changed files with 4,990 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
# Do not attempt any end-of-line conversion upon checkin or checkout.
* -text
###############################################################################
# Convert these files to LF on checkin or checkout.
###############################################################################
*.[sS][hH] text eol=lf
*.[mM][dD] text eol=lf
*.[pP][sS]1 text eol=lf
*.[tT][fF] text eol=lf
*.[hH][cC][lL] text eol=lf
*.[yY][mM][lL] text eol=lf
*.[yY][aA][mM][lL] text eol=lf
*.[jJ][sS][oO][nN] text eol=lf
*.tf.example text eol=lf
*.json.example text eol=lf
*.tfvars.example text eol=lf
LICENSE text eol=lf
state-backend-template text eol=lf
###############################################################################
# Convert these files to CRLF on checkin or checkout.
###############################################################################
###############################################################################
# Define file name extensions for git lfs handling
###############################################################################
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
*.png binary
#*.gif binary
###############################################################################
82 changes: 82 additions & 0 deletions .github/workflows/qualitygate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: qualitygate

on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
qualitygate:
name: Qualitygate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
#fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
ref: ${{ github.event.pull_request.head.ref }}
- name: HashiCorp - Setup Terraform
uses: hashicorp/setup-terraform@v2.0.0
with:
# # The hostname of a Terraform Cloud/Enterprise instance to place within the credentials block of the Terraform CLI configuration file. Defaults to `app.terraform.io`.
# cli_config_credentials_hostname: # optional, default is app.terraform.io
# # The API token for a Terraform Cloud/Enterprise instance to place within the credentials block of the Terraform CLI configuration file.
# cli_config_credentials_token: # optional
# # The version of Terraform CLI to install. Instead of full version string you can also specify constraint string starting with "<" (for example `<1.13.0`) to install the latest version satisfying the constraint. A value of `latest` will install the latest version of Terraform CLI. Defaults to `latest`.
terraform_version: 1.3.0 # optional, default is latest
# # Whether or not to install a wrapper to wrap subsequent calls of the `terraform` binary and expose its STDOUT, STDERR, and exit code as outputs named `stdout`, `stderr`, and `exitcode` respectively. Defaults to `true`.
# terraform_wrapper: # optional, default is true

- name: Setup tflint
uses: terraform-linters/setup-tflint@v2

- name: Terraform format
run: terraform fmt -check -recursive

- name: Terraform init
run: terraform init -backend=false

- name: Terraform validate
run: terraform validate

- name: Init TFLint
run: tflint --init

- name: Terraform lint Root
run: tflint

- name: Terraform lint SIMPHERA Base
run: tflint --config ../../.tflint.hcl --chdir ./modules/simphera_aws_instance

- name: tfsec action
uses: aquasecurity/tfsec-action@v1.0.2
with:
additional_args: --exclude-downloaded-modules --config-file tfsec.yaml

- name: Terraform-docs Update README.md
uses: terraform-docs/gh-actions@v1.0.0
with:
working-dir: .
output-file: README.md
output-method: inject
git-push: "true"

- name: Terraform-docs Regenerate terraform.tfvars.example
uses: terraform-docs/gh-actions@v1.0.0
with:
working-dir: .
config-file: tfvars.hcl.terraform-docs.yml
output-file: terraform.tfvars.example
output-method: replace
template: |
{{ .Content }}
git-push: "true"

- name: Terraform-docs Regenerate terraform.json.example
uses: terraform-docs/gh-actions@v1.0.0
with:
working-dir: .
output-file: terraform.json.example
output-format: tfvars json
output-method: replace
template: |
{{ .Content }}
git-push: "true"

32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Local .terraform directories
**/.terraform
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# all .tfvars files except template ones
#**/*.tfvars
!common/config_template.tfvars
!instance/config_template.tfvars

# all state-backends
**/state-backend.tf


**/OLD_*

**/kubeconfig

**/charts

wildcard.crt
wildcard.key

temp
terraform.log

tfsec

.vs
31 changes: 31 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
repos:
- repo: local
hooks:
- id: terraform_format
name: terraform_format
entry: --entrypoint /src/hooks/terraform_format.sh hashicorp/terraform:1.5.2
language: docker_image
- repo: local
hooks:
- id: terraform_validate
name: terraform_validate
entry: "--entrypoint /src/hooks/terraform_validate.sh -v tfvalidate:/src/cache hashicorp/terraform:1.5.2"
language: docker_image
- repo: local
hooks:
- id: tflint
name: tflint
entry: --entrypoint /src/hooks/tflint.sh ghcr.io/terraform-linters/tflint:v0.48.0
language: docker_image
- repo: local
hooks:
- id: tfsec
name: tfsec
entry: --entrypoint /src/hooks/tfsec.sh aquasec/tfsec:v1.28
language: docker_image
- repo: local
hooks:
- id: terraform_docs
name: terraform_docs
entry: --entrypoint /src/hooks/terraform_docs.sh quay.io/terraform-docs/terraform-docs:0.16.0
language: docker_image
Loading

0 comments on commit bc06eea

Please sign in to comment.