- Notifications
You must be signed in to change notification settings - Fork0
Example of infrastructure repo with terraform, ansible and continuous delivery
License
tldr-devops/infrastructure-example
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This example was conceived as an infrastructure for one AWS account with one region and division into dev, management and prod environments.But it can be extended for multiple regions, aws accounts and other clouds.
Current files structure:
ansible/ansible.cfgansible/group_vars/all.ymlansible/inventoryansible/playbooks/users.ymlansible/roles/users/README.mdansible/roles/users/defaults/main.ymlansible/roles/users/handlers/main.ymlansible/roles/users/tasks/main.ymlterraform/environments/aws-account-id/backend.hclterraform/environments/aws-account-id/global/management/.gitkeepterraform/environments/aws-account-id/us-east-2/dev/ec2/instance/example/main.tfterraform/environments/aws-account-id/us-east-2/dev/ec2/instance/example/output.tfterraform/environments/aws-account-id/us-east-2/dev/ec2/instance/example/terragrunt.hclterraform/environments/aws-account-id/us-east-2/dev/ec2/instance/example/variables.tfterraform/environments/aws-account-id/us-east-2/dev/vpc/default/main.tfterraform/environments/aws-account-id/us-east-2/dev/vpc/default/output.tfterraform/environments/aws-account-id/us-east-2/dev/vpc/default/terragrunt.hclterraform/environments/aws-account-id/us-east-2/management/ec2/key_pair/terraform/main.tfterraform/environments/aws-account-id/us-east-2/management/ec2/key_pair/terraform/terragrunt.hclterraform/environments/aws-account-id/us-east-2/management/s3/terraform_state/main.tfterraform/environments/aws-account-id/us-east-2/management/s3/terraform_state/output.tfterraform/environments/aws-account-id/us-east-2/management/s3/terraform_state/terragrunt.hclterraform/environments/aws-account-id/us-east-2/management/vpc/default/main.tfterraform/environments/aws-account-id/us-east-2/management/vpc/default/terragrunt.hclterraform/environments/aws-account-id/us-east-2/prod/vpc/default/main.tfterraform/environments/aws-account-id/us-east-2/prod/vpc/default/terragrunt.hclterraform/environments/aws-account-id/us-east-2/region.hclterraform/environments/terragrunt.hclterraform/modules/aws/ec2/ami/main.tfterraform/modules/aws/ec2/ami/outputs.tfterraform/modules/aws/ec2/ami/variables.tfterraform/modules/aws/ec2/terraform_key_pair/main.tf
Time track:
- Filipp Frizzy 28.25h
In this setup I use terraform with terragrunt for provisioning whole infrastructure.Terraform can store it's state in files or in remote backend via S3 orTerraform Cloud.For command work we should use only remote state. In this setup I use AWS S3terraform_state
bucket + DynamoDB for locking.This require some initial preparation:
cd terraform/environments/aws-account-id/us-east-2/management/s3/terraform_state/terraform initterraform applysed -i "s/terraform_state_bucket/$(terraform output terraform_state_s3_bucket_name|sed 's/\"//g')/g" ../../../../backend.hclterragrunt init
- How to Build an End to End Production-Grade Architecture on AWS
- A Comprehensive Guide to Terraform
- How to manage Terraform state
- Terragrunt: how to keep your Terraform code DRY and maintainable
- Automate Terraform with GitHub Actions
- Terraform up and running
- How to create reusable infrastructure with Terraform modules
- How to use Terraform as a team
- A comprehensive guide to managing secrets in your Terraform code
- 5 Lessons Learned From Writing Over 300,000 Lines of Infrastructure Code
About
Example of infrastructure repo with terraform, ansible and continuous delivery
Resources
License
Uh oh!
There was an error while loading.Please reload this page.