Created
June 12, 2020 12:17
Star
You must be signed in to star a gist
Provision S3 buckets for state management with Terraform
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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