{"id":20786197,"url":"https://github.com/mijndert/aws-tf-reference","last_synced_at":"2025-05-05T15:49:34.052Z","repository":{"id":165933649,"uuid":"598301623","full_name":"mijndert/aws-tf-reference","owner":"mijndert","description":"A reference architecture for AWS using Terraform","archived":false,"fork":false,"pushed_at":"2024-04-30T07:33:24.000Z","size":34,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-30T08:41:46.884Z","etag":null,"topics":["aws","infrastructure-as-code","terraform"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mijndert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-02-06T20:30:28.000Z","updated_at":"2024-04-30T07:33:28.000Z","dependencies_parsed_at":"2023-11-27T08:49:30.767Z","dependency_job_id":null,"html_url":"https://github.com/mijndert/aws-tf-reference","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mijndert%2Faws-tf-reference","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mijndert%2Faws-tf-reference/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mijndert%2Faws-tf-reference/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mijndert%2Faws-tf-reference/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mijndert","download_url":"https://codeload.github.com/mijndert/aws-tf-reference/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225053054,"owners_count":17413592,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","infrastructure-as-code","terraform"],"created_at":"2024-11-17T14:51:09.280Z","updated_at":"2024-11-17T14:51:09.877Z","avatar_url":"https://github.com/mijndert.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform Reference Architecture for AWS\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n\u003e **Warning**:\n\u003e This code is provided as-is — it is not meant to be executed verbatim. No support is provided in any way.\n\n## Introduction\n\nThis is a very basic implementation of a Terraform codebase for infrastructure on AWS. Because this codebase acts as an example, everything is left as generic and default as possible. The only thing that can potentially be called opinionated is the file/folder structure.\n\nThe folder structure is set up with a few goals in mind:\n\n- Each part of the infrastructure is its own module in the `modules` folder;\n- Each environment is separated in the `environments` folder with their own default tags;\n- Each part of an environment gets its own statefile as to reduce the blast radius;\n- In order to not repeat myself, symlinks of the `provider.tf` file are created in places where it's needed.\n\n## Getting started\n\n### Terraform \u0026 shell configuration\n\nTo get started you first have to install Terraform on your machine. Installation instructions for all platforms [can be found here](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli).\n\nTo make life a little easier you can add this alias in whatever shell configuration you have:\n\n```\nalias tf=\"terraform\"\n```\n\n### Setting up statefile management\n\nBefore you can start working with setting up environments using Terraform you have to set up everything needed for state management. This is a one time process for each new AWS account.\n\n```\ncd modules/state\ntf init\ntf apply\n```\n\nTerraform will ask to name the new S3 bucket where the statefile will be stored. Further information can be found in `modules/state/README.md`.\n\nAfter this initial setup you can delete the `modules/state/.terraform` folder.\n\n## Security groups\n\nSecurity Groups are defined within the VPC module because this makes it easier to reference them into each other and tighten security.\n\nEach VPC has a `Name` tag associated which is used in datasources inside of other modules.\n\n```\ndata \"aws_security_group\" \"this\" {\n  tags = {\n    Name = \"...\"\n  }\n}\n```\n\nThis returns the ID of the security group:\n\n```\nsecurity_groups = [ data.aws_security_group.this.id ]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmijndert%2Faws-tf-reference","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmijndert%2Faws-tf-reference","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmijndert%2Faws-tf-reference/lists"}