Skip to content

Instantly share code, notes, and snippets.

@emileswarts
Created June 12, 2020 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emileswarts/a2d68ef6ba544e34ab1b52725985e56d to your computer and use it in GitHub Desktop.
Save emileswarts/a2d68ef6ba544e34ab1b52725985e56d to your computer and use it in GitHub Desktop.
Provision S3 buckets for state management with Terraform
#!/bin/bash
set -x
aws sts get-caller-identity --region eu-west-2
echo $AWS_PROFILE
aws s3 ls
if aws s3 ls "s3://$AWS_PROFILE-tf-remote-state" 2>&1 | grep -q 'NoSuchBucket'; then
aws s3 mb s3://$AWS_PROFILE-tf-remote-state
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment