- AWS Account
- AWS API User API Key/Secret
- Bitbucket Account
- Create or update an existing Bitbucket repo
- Open https://bitbucket.org/USERNAME/REPO/addon/pipelines/deployments
- Set your
bitbucket-pipelines.yml
with the content of the attached file - Commit file
- Open your repo settings > Repository Variables
- Create
AWS_ACCESS_KEY_ID
with your AWS Api Key (mark as secret) - Create
AWS_SECRET_ACCESS_KEY
with your AWS Secret Api Key (mark as secret) - Create
AWS_DEFAULT_REGION
with an AWS Region (optinal if not set in your AWS provider file) - Create and commit a file called
aws.tf
with the content of the attached file- For more information about the Terraform AWS provider check here
- Create an S3 bucket (should be private, enable versioning)
- Create a dynamo DB table
- Create and commit a file called
terraform.tf
with the content of the attached file- Replace
BUCKET-NAME
with your bucket name - Replace
DYNAMODB-NAME
with your dynamo DB table name - For more information about the AWS Terraform backend check here
- Replace
- You are now ready to start deploying
To use this for deployments:
- Create a file with Terraform AWS resources.
- Commit to a development branch
- The pipeline will test to make sure the code is valid and show a plan of what will be created/updated/removed
- If the pipeline passes, merge the changes to the master branch
- The pipeline will again test and plan the steps before going ahead and deploying the new code