Created
June 12, 2020 12:17
-
-
Save emileswarts/a2d68ef6ba544e34ab1b52725985e56d to your computer and use it in GitHub Desktop.
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