Skip to content

Initialize environment

Step 1: Create environment directory

Navigate to the directory where you checked out the repository in the previous step:

# Example command.
# Replace <~/projects/repo-iac> with the location of your repository
cd ~/projects/repo-iac

First create a new directory for all the environments you want to create (dev, qa, prod, etc.):

repo-iac/
mkdir environments
cd environments/

Create a new directory for your first environment. We will use dev as an example:

repo-iac/environments
mkdir dev
cd dev/

Create a new directory for configuration files that will be used by boilerplate:

repo-iac/environments/dev
mkdir _config

Step 2: Create a new configuration file

Create a common-config.yml file in the newly created _config/ directory with the following content:

repo-iac/environments/dev/_config/common-config.yml
AccountId: "1234567890"
Region: "eu-west-1"
Team: "pirates"
Environment: "pirates-dev"
Parameter Description Validation
AccountId The AWS account ID where the environment will be created. How do I find my account ID?.
Region The AWS region where the environment will be created. Typically: eu-west-1.
Team The name of your team. This will be used as part of AWS resource names. Alpha-numeric and dashes
Environment The name of the environment. This will be used as part of AWS resource names, for example the S3 bucket created to store the remote_state. Note: We recommend that the name contains the environment in question, for example dev/prod/staging. Alpha-numeric and dashes

This file will be used for all templates in the dev stack.

Step 3: Create packages.yml

Navigate back to the dev directory

repo-iac/environments/dev/_config
cd ..

Create a packages.yml file with the following content:

repo-iac/environments/dev/packages.yml
Packages: 

This file will be used by Boilerplate to keep track of which packages are installed.

Next step

Set up remote state to create the necessary S3 bucket and DynamoDB table that will be used to store Terraform state remotely.