Skip to content

Commit 02f9079

Browse files
authored
Bucket access check script change (#6)
* Testing script change * Adjust README
1 parent 5793266 commit 02f9079

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454

5555
steps:
5656
- name: Create deploy-bucket
57-
uses: bitovi/[email protected].3
57+
uses: bitovi/[email protected].4
5858
with:
5959
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_SANDBOX}}
6060
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_SANDBOX}}

scripts/create_tf_state_bucket.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ else
1111
else
1212
aws s3api create-bucket --bucket $TF_STATE_BUCKET --region $AWS_DEFAULT_REGION --create-bucket-configuration LocationConstraint=$AWS_DEFAULT_REGION || true
1313
fi
14-
15-
if ! [[ -z $(aws s3api head-bucket --bucket $TF_STATE_BUCKET 2>&1) ]]; then
16-
echo "Bucket does not exist or permission is not there to use it."
14+
touch bitovi-test-file.txt
15+
if ! [[ -z $(aws s3api put-object --bucket $TF_STATE_BUCKET --key bitovi-test-file.txt --body ./bitovi-test-file.txt 2>&1 >/dev/null ) ]]; then
16+
echo "Permission issue: Unable to write to the bucket."
1717
exit 63
18+
else
19+
if ! [[ $(aws s3 rm "s3://$TF_STATE_BUCKET/bitovi-test-file.txt" 2>&1 >/dev/null ) ]]; then
20+
echo "Access to bucket confirmed. Can create and delete a tf-state file"
21+
fi
1822
fi
23+
rm bitovi-test-file.txt
1924
fi

terraform_code/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ locals {
106106
GitHubOrgName = "${var.app_org_name}"
107107
GitHubRepoName = "${var.app_repo_name}"
108108
GitHubBranchName = "${var.app_branch_name}"
109-
GitHubAction = "bitovi/github-actions-deploy-serverless-website"
109+
GitHubAction = "bitovi/github-actions-deploy-static-site-to-aws"
110110
created_with = "terraform"
111111
}
112112
}

0 commit comments

Comments
 (0)