https://github.com/kolosovpetro/terraform-template
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.
https://github.com/kolosovpetro/terraform-template
azure-pipelines ci-cd github-actions terraform terraform-template
Last synced: 3 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/kolosovpetro/terraform-template
- Owner: kolosovpetro
- License: gpl-2.0
- Created: 2023-08-30T10:34:19.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2025-02-03T01:59:48.000Z (9 months ago)
- Last Synced: 2025-02-03T02:31:06.341Z (9 months ago)
- Topics: azure-pipelines, ci-cd, github-actions, terraform, terraform-template
- Language: HCL
- Homepage: https://dev.azure.com/PetroKolosovProjects/TerraformTemplate
- Size: 48.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
- [Define your naming convention](https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/resource-naming)
- [Azure naming module](https://registry.terraform.io/modules/Azure/naming/azurerm/latest)## Terraform Init
- Create and configure Azure Storage Account for Terraform state
- Create `azure.sas.conf` file with the following content:
```bash
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::git@bitbucket.org:kolosovpetro/terraform.git//modules/storage`
- Github SSH: `git::git@github.com: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
- https://github.com/antonbabenko/pre-commit-terraform
- https://github.com/kolosovpetro/AzureTerraformBackend
- https://github.com/terraform-docs/terraform-docs
- https://terraform-docs.io/user-guide/installation/
- https://pre-commit.com/## Deploy storage account for terraform state
- See [CreateAzureStorageAccount.ps1](./CreateAzureStorageAccount.ps1)