Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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