...
We write our declarative configuration files (*.tf
files known as Terraform configuration) in our https://github.com/edx/terraform/ repository. Files relevant to frontend infrastructure:
modules/frontend/main.tf is a module that defines a common variables or variable definitions and collection of infrastructure resources and variables for frontends. This module is included in each specific frontend’s terraform configuration. (resources include S3, Route53, CloudFlare, Cloudflare Worker, and CloudFront resources).
https://github.com/edx/terraform/blob/0fcc8ab346db9b9c38e66343d638b03e822e7e6f/plans/edx/prod-frontends/aws.tf defines default information related to AWS as a provider and how we’ll interact with it: roles, regions, etc. A couple acronyms you’ll see:
arn
= AWS Resource Name
https://github.com/edx/terraform/blob/0fcc8ab346db9b9c38e66343d638b03e822e7e6f/plans/edx/prod-frontends/cloudflare.tf defines a Cloudflare
zone_id
. Azone
is a domain name along with its subdomains and other identities.https://github.com/edx/terraform/blob/0fcc8ab346db9b9c38e66343d638b03e822e7e6f/plans/edx/prod-frontends/frontend.tf defines a user (
frontend_deployer_user
) with which infrastructure will be manipulated. ??? is this true ???https://github.com/edx/terraform/blob/0fcc8ab346db9b9c38e66343d638b03e822e7e6f/plans/edx/prod-frontends/terraform.tfvars are common variable definitions. They are automatically included in the environment when a frontend-app-*** is planned. (you can see how this is done in https://github.com/edx/terraform/blob/master/utils/env.sh).
https://github.com/edx/terraform/blob/0fcc8ab346db9b9c38e66343d638b03e822e7e6f/plans/edx/prod-frontends/vpcvars.tf (
vpc
= Virtual Private Cloud) defines the environment “prod” or “stage”https://github.com/edx/terraform/blob/0fcc8ab346db9b9c38e66343d638b03e822e7e6f/plans/edx/prod-frontends/frontend-app-learning.tf or any
frontend-app-*.tf
config file provides the specific config values for a given microfrontend and leverages the modules/frontend/main.tf module above to define all the resources needed to serve that mfe properly.
plans/edx/stage-frontends/* contains the same set of files and definitions as the corresponding prod-frontends directory.
...