Skip to content

Latest commit

 

History

History
50 lines (40 loc) · 1.73 KB

README.md

File metadata and controls

50 lines (40 loc) · 1.73 KB

Terraform IaC

Configure the AWS CLI

  1. Install AWS CLI
  2. Create an AWS profile in your local AWS configuration (~/.aws/*) with access keys of a user with right permissions for provisioning resources mentioned in Components section below.
$ aws configure --profile orion
AWS Access Key ID [None]: AK*********E
AWS Secret Access Key [None]: je7M***************EY
Default region name [None]: eu-west-1
Default output format [None]: text
  1. set aws cli to use orion AWS profile:
export AWS_PROFILE=orion

Create an S3 bucket for terraform state (on first provisioning only)

  1. Create a bucket:
aws s3api create-bucket --bucket orion-tf-state-<org> --region eu-west-1 --create-bucket-configuration LocationConstraint=eu-west-1 --profile=orion

Where is the name of the organisation you are provisioning (remember that S3 buckets are in the global name space).

  1. Enable versioning on the bucket:
aws s3api put-bucket-versioning --bucket orion-tf-state-<org> --versioning-configuration Status=Enabled --profile=orion

Terraform provisioning

  1. Install Terraform
  2. Init Terraform:
terraform init -backend-config="bucket=orion-tf-state-<org>" -backend-config="key=terraform.tfstate" -backend-config="region=eu-west-1" -backend-config="profile=orion"
  1. Rename sample.input-[env].tfvars to input-[env].tfvars and fill in missing secrets:
  2. Run plan:
terraform plan -var-file input-[env].tfvars
  1. Provision the infrastructure:
terraform apply -var-file input-[env].tfvars