Skip to content
Switch branches/tags


Failed to load latest commit information.
Latest commit message
Commit time

Note: This module is in alpha state and is likely to contain bugs and updates may introduce breaking changes. It is not recommended for production use at this time.

Terraform AWS CodeCommit

This module deploys Terraform-managed AWS CodeCommit.

Author: Tony Vattahil (

Install Terraform

To deploy this module you must install Terraform. See Install Terraform for a tutorial.

Sign up for Terraform Cloud

Sign up and log into Terraform Cloud. (There is a free tier available.)

Configure Terraform Cloud API Access

Generate a Terraform Cloud token.

terraform login

Export the TERRAFORM_CONFIG variable.

export TERRAFORM_CONFIG="$HOME/.terraform.d/credentials.tfrc.json"

Configure your tfvars file

Example filepath = $HOME/.aws/terraform.tfvars

Example tfvars file contents

In the example, replace *** with your AKEY and SKEY.

AWS_SECRET_ACCESS_KEY = "*****************"
AWS_ACCESS_KEY_ID = "*****************"
AWS_SESSION_TOKEN = "*****************"

Note: STS-based credentials are optional but highly recommended.

!!!!CAUTION!!!!: Make sure your credentials are secured outside of version control and follow secrets-management best practices.

Deploy the module (Linux or Mac)

Clone the aws-ia/terraform-aws-codecommit repository.

git clone

Change directory to the root directory.

cd terraform-aws-codecommit/

Change to the deploy directory.

cd setup_workspace.

Run to following commands in order:

terraform init

terraform apply or terraform apply -var-file="$HOME/.aws/terraform.tfvars".

Change directory to the deploy directory. (The previous command automatically generates backend.hcl.)

cd ../deploy

terraform apply or terraform apply -var-file="$HOME/.aws/terraform.tfvars".

Terraform apply is run remotely in Terraform Cloud.