File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88 - env
99 - git clone -b $REFERENCE_NAME codecommit::$REPO_REGION://$REPOSITORY_NAME
1010 - dt=$(date '+%d-%m-%Y-%H:%M:%S');
11- - echo "$dt"
12- - zip -yr $dt-$REPOSITORY_NAME-backup.zip ./
13- - aws s3 cp $dt-$REPOSITORY_NAME-backup.zip s3://$BUCKET/$REPOSITORY_NAME/
11+ - echo "$dt"
12+ - SHORT_COMMIT_ID=$(echo "$COMMIT_ID" | cut -c1-8)
13+ - object=$dt-$REPOSITORY_NAME-$SHORT_COMMIT_ID
14+ - zip -yr $object.zip ./
15+ - aws s3 cp $object.zip s3://$BUCKET/$REPOSITORY_NAME/
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ resource "aws_cloudwatch_event_target" "this" {
4141 repositoryName = " $.detail.repositoryName" ,
4242 account = " $.account" ,
4343 referenceName = " $.detail.referenceName" ,
44+ commitId = " $.detail.commitId" ,
4445 }
4546 input_template = << EOF
4647{
@@ -64,6 +65,10 @@ resource "aws_cloudwatch_event_target" "this" {
6465 {
6566 "name": "ACCOUNT_ID",
6667 "value": <account>
68+ },
69+ {
70+ "name": "COMMIT_ID",
71+ "value": <commitId>
6772 }
6873 ]
6974}
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ data "aws_iam_policy_document" "codebuild" {
8181 ]
8282
8383 resources = [
84- " ${ aws_s3_bucket . this . arn } " ,
84+ aws_s3_bucket . this . arn ,
8585 " ${ aws_s3_bucket . this . arn } /*"
8686 ]
8787 }
Original file line number Diff line number Diff line change @@ -42,8 +42,8 @@ data "aws_iam_policy_document" "this" {
4242 ]
4343
4444 resources = [
45- " ${ aws_s3_bucket . this . arn } /* " ,
46- " ${ aws_s3_bucket . this . arn } "
45+ aws_s3_bucket . this . arn ,
46+ " ${ aws_s3_bucket . this . arn } /* "
4747 ]
4848
4949 condition {
You can’t perform that action at this time.
0 commit comments