This Terraform config includes
Employs module composition
https://www.terraform.io/docs/modules/composition.html
To deploy using GitHub Actions, you'll need to get the infrastructure up and running using Terraform.
Ensure you've got the following installed, so you can run the Terraform scripts.
- an authenticated AWS CLI (log in with
aws sso login --profile my-profile
) - an authenticated GitHub CLI (log in with
gh auth login
)
You'll then need to
- Download the necessary providers and modules using
terraform init
- Deploy the infrastructure using
terraform apply
This
- sets up the necessary infrastructure (IAM accounts, GitHub Actions secrets, ACM certificates)
- configures everything necessary to host the frontend (Route 53 records, S3 bucket, CloudFront)
- configures everything necessary to host the backend (ALB, ASG, launch templates, security groups)
You'll need to configure some variables to deploy to your own infrastructure.
region
: the AWS region you want to set up your resources in. This defaults tous-east-1
. However, ACM certificates are always created inus-east-1
, as CloudFront can only use certificates from that region.domain
: the "base domain" you want to use for your blog. For example, if you want to useblog.example.com
, you'd set this toexample.com
.frontend_subdomain
: the subdomain you want users to visit to access your blog. For example, if you want to useblog.example.com
, you'd set this toblog
. This defaults tosh
.server_subdomain
: the subdomain you want to use for the backend. For example, if you want to useblog.example.com
, you'd set this toserver
.instance_type
: the instance type to use in your ASG. This defaults tot3.micro
. These Terraform scripts will spin up an ASG in subnets in regions where the instance type is available.repository
: the GitHub repository for the project. This is used for GitHub Actions secrets. This defaults toleoriviera/contained
.
terraform init
, to download the necessary providers.
terraform apply
, to deploy the infrastructure.