mozilla-iam / iam-infra

This repo contains the resources and configuration needed to create the Mozilla IAM infrastructure
Mozilla Public License 2.0
13 stars 13 forks source link

iam-infra

This repository contains all the code and resources needed for creating the infrastructure used in the IAM project, or more precisely for DinoPark.

Repository structure

The repository is structured in top-level folders containing the different kind of resources needed to create AWS resources (terraform folder), configuring the different Kubernetes cluster (kubernetes folder), documentation, scripts which automate common operations and dockerfiles specific to the IAM project.

The Terraform code and Kubernetes manifests are organized by folders representing the different environments as observed by the infrastructure, and inisde there are organized by the AWS region where reside. This layout clearly has the disadvantage of repeating code, but has the advantage of knowing exactly what is deployed and where just looking at the folders. In this way you don't have to look at templates and render values in your head but just go and look at the code. While this has helped us during the beginning, once we reach a more mature state we might decide to use Helm for templating Kubernetes manifests or modify Terraform resources to create modules..

Terraform code

The Terraform code, as stated above is divided in folder representing environments and location. Also the resources needed for both environments staging and production will go to the global folder, like for example a policy allowing other AWS account to fetch metrics. Inside of each environment and location the code is organized in independent modules. This means that each of the components are maintaining its own state file rather than sharing one for all the resources. This design has mostly 2 implications that can be considered an advantage or a disadvantage. The first one is that you can issue terraform delete only affecting the resource that you want, think for example if we stop using Graylog, issuing a terraform destroy on the Graylog folder will delete the ES cluster and DNS name but leave the rest of the infrastructure as it is. The second implication is that in order to share the state we use remote_state pointing to the state file used by the resource for example most of the services need to know the VPC id and are adding it as a remote state.

Kubernetes code

The Kubernetes manifests present on this repository are organized in a similar fashion to the Terraform ones. Inside the Kubernetes folder we can find 2 more folder each one corresponding to one of the clusters: one for production and one for staging. Here there is all the infrastructure resources, the manifests containing application specific resources like namespaces and deployments are living in each application repository.

Documentation

Documentation about differen topics like managing users in EKS, deploying applications into the cluster, troubleshooting problems and monitoring applications can be found in different files inside the docs folder. These different files are intended for developers and administrators.

Here is a table of content with the different topics: