automated terminal push

This commit is contained in:
lenape
2025-08-04 02:09:06 +00:00
parent fe8b9fb0f0
commit 5602f1d7b0

View File

@@ -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