Skip to content

Latest commit

 

History

History
64 lines (45 loc) · 1.72 KB

README.tpl.md

File metadata and controls

64 lines (45 loc) · 1.72 KB

Terraform Bucket

This repository provides scripts for bootstrapping buckets (and in the case of GCP, a project) to store Terraform state.

To initialise an AWS bucket use:

curl -L https://raw.githubusercontent.com/aps831/terraform-bucket/${TAG}/aws-init.sh | bash -s -- --prefix ${prefix} --project ${project} --profile ${profile} --region ${region} --tag ${tag}

where

prefix  = prefix for uniqueness constraint
project = project name (eg git repo)
profile = AWS profile
region  = AWS region (eg eu-west-2)
tag     = tag to add to AWS resources

Note that the S3 bucket with name ${prefix}-${project}-terraform-state must be globally unique.

To cleanup an AWS bucket use:

curl -L https://raw.githubusercontent.com/aps831/terraform-bucket/${TAG}/aws-cleanup.sh | bash -s -- --prefix ${prefix} --project ${project} --profile ${profile} --region ${region}

where

prefix  = prefix for uniqueness constraint
project = project name (eg git repo)
profile = AWS profile
region  = AWS region (eg eu-west-2)

To initialise a GCP project and bucket use:

curl -L https://raw.githubusercontent.com/aps831/terraform-bucket/${TAG}/gcp-init.sh | bash -s -- --account ${account} --gcpproject ${gcpproject} --region ${region}

where

account    = GCP account email address
gcpproject = GCP project name
region     = GCP region (eg europe-west2)

Note that gcpproject and the storage bucket with name ${gcpproject}-terraform-state must be globally unique.

To cleanup a GCP project and bucket use:

curl -L https://raw.githubusercontent.com/aps831/terraform-bucket/${TAG}/gcp-cleanup.sh | bash -s -- --gcpproject ${gcpproject}

where

gcpproject = GCP project name