This is an older implementation, I recommend you look at Bootstrapping your Terraform automation with Amazon CodeCatalyst that I wrote on how to set up the permissions and bootstrap Terraform. There is also a followup guide on how you can start Automating Multiple Environments with Terraform.
You can use the implementation in these to also use GitHub Actions if you prefer to manage multiple environments.
This repo is used to set up the infrastructure used to build and deploy a container to ECS Fargate for a webinar.
- Create an IAM user with sufficient permissions to create the infrastructure you require. Generate an API key for the user, and create a named profile in
~/.aws/credentials
that looks like this:
[aws-webinar]
aws_access_key_id = your_api_key
aws_secret_access_key = your_api_key_secret
-
Create an S3 bucket in your region of choice. Edit
infra/terraform-state.tf
by replacing thebucket
,region
andprofile
values to what you have configured. -
Run
terraform init
in theinfra
directory. -
In
infra/variables.tf
, change thegithub_username
andgithub_repo_name
defaults to your ones. -
Create
infra/secret.tf
with the following:
locals {
webhook_secret = "web-hook-secret-shared-string"
github_token = "github-token-with-permission-to-create-webhooks"
github_username = "cobusbernard"
}