Skip to content

Terraform template for modules and sub-modules. Includes pre-commit hooks that lint the terraform code and generate module's documentation as part of README file. Contains examples of terraform CI/CD pipelines for GitHub Actions and Azure Pipelines.

License

Notifications You must be signed in to change notification settings

kolosovpetro/terraform-template

Repository files navigation

Terraform template

Terraform template for modules and submodules. Includes pre-commit hooks that lint the terraform code and generate module's documentation as part of README file. Contains examples of terraform CI/CD pipelines for GitHub Actions and Azure Pipelines.

Azure naming conventions

Terraform Init

  • Create and configure Azure Storage Account for Terraform state
  • Create azure.sas.conf file with the following content:
    storage_account_name = "storage_account_name"
    container_name       = "container_name"
    key                  = "terraform.tfstate"
    sas_token            = "sas_token"
  • terraform init -backend-config="azure.sas.conf" -reconfigure -upgrade

Module referencing

  • Bitbucket SSH: git::[email protected]:kolosovpetro/terraform.git//modules/storage
  • Github SSH: git::[email protected]:kolosovpetro/terraform.git//modules/storage
  • Github HTTP: github.com/kolosovpetro/AzureLinuxVMTerraform.git//modules/ubuntu-vm-key-auth-no-pip?ref=master

Pre-commit configuration

  • Install python3 via Windows Store
  • pip install --upgrade pip
  • pip install pre-commit
  • Update PATH variable
  • pre-commit install

Install terraform docs

  • choco install terraform-docs

Install tflint

  • choco install tflint

Documentation

Deploy storage account for terraform state

About

Terraform template for modules and sub-modules. Includes pre-commit hooks that lint the terraform code and generate module's documentation as part of README file. Contains examples of terraform CI/CD pipelines for GitHub Actions and Azure Pipelines.

Topics

Resources

License

Stars

Watchers

Forks