The Problem
While all companies are unique, their infrastructure doesn't need to be. Well-built infrastructure consists of reusable building blocks that implement all the standard components like servers, clusters, load balancers, etc. Rather than building everything from scratch “the hard way”, there's an easier way. Using our “reference architecture” and its service catalog of all the essential pieces of infrastructure, everything a business needs can be composed together as an architecture using “Stack” configurations. Best of all, it's all native terraform.
Our Solution
Cloud Posse defines components. Components are opinionated, self-contained building blocks of Infrastructure-as-Code (IAC) that solve one specific problem or use-case. Components are similar to a Terraform root module and define a set of resources for any deployment.
- Terraform components live under the
components/terraform
directory. - Cloud Posse maintains a collection of public components with
terraform-aws-components
- The best components are generic enough to be reused in any organization, but there's nothing wrong with writing specialized components for your company.
- Detailed documentation for using components with Atmos can be found under atmos.tools Core Concepts
We recommend that you always check first with Cloud Posse to see if we have an existing component before writing your own. Sometimes we have work that has not yet been upstreamed to our public repository.
Prerequisites
In order to be able to create a new component, this document assumes the developer has the following requirements:
- Authentication to AWS, typically with Leapp
- The infrastructure repository cloned locally
- Geodesic up and running
- A basic understanding of Atmos
- An intermediate understanding of Terraform
1 Create the component in Terraform
-
Make a new directory in
components/terraform
with the name of the component -
Add the files that should typically be in all components:
.
├── README.md
├── component.yaml # if vendoring from cloudposse
├── context.tf
├── main.tf
├── outputs.tf
├── providers.tf
├── remote-state.tf