automated terminal push
This commit is contained in:
@@ -30,6 +30,19 @@ aws sts get-caller-identity || {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check if ANY state bucket already exists
|
||||
EXISTING_BUCKET=$(aws s3 ls | grep "nvhi-atsila-microservice-terraform-state" | head -n1 | awk '{print $3}')
|
||||
|
||||
if [ -n "$EXISTING_BUCKET" ]; then
|
||||
echo "✅ Using existing bucket: $EXISTING_BUCKET"
|
||||
BUCKET_NAME=$EXISTING_BUCKET
|
||||
else
|
||||
# Only create new if none exists
|
||||
BUCKET_SUFFIX=$(openssl rand -hex 4)
|
||||
BUCKET_NAME="${PROJECT_NAME}-terraform-state-${BUCKET_SUFFIX}"
|
||||
# ... create bucket
|
||||
fi
|
||||
|
||||
# Create S3 bucket for Terraform state
|
||||
echo "📦 Creating S3 bucket for Terraform state..."
|
||||
if aws s3api head-bucket --bucket "${BUCKET_NAME}" 2>/dev/null; then
|
||||
|
||||
Reference in New Issue
Block a user