@@ -140,6 +140,8 @@ Resources:
140140 Type : AWS::S3::Bucket
141141 Properties :
142142 Tags : []
143+ VersioningConfiguration :
144+ Status : Enabled
143145
144146 CopyZips :
145147 Type : AWS::CloudFormation::CustomResource
@@ -164,7 +166,7 @@ Resources:
164166 Service : lambda.amazonaws.com
165167 Action : sts:AssumeRole
166168 ManagedPolicyArns :
167- - arn:aws :iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
169+ - Sub ' arn:${AWS::Partition} :iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
168170 Path : /
169171 Policies :
170172 - PolicyName : lambda-copier
@@ -182,7 +184,7 @@ Resources:
182184 - s3:PutObject
183185 - s3:DeleteObject
184186 Resource :
185- - !Sub ' arn:aws :s3:::${LambdaZipsBucket}/${QSS3KeyPrefix}*'
187+ - !Sub ' arn:${AWS::Partition} :s3:::${LambdaZipsBucket}/${QSS3KeyPrefix}*'
186188 - Effect : Allow
187189 Action :
188190 - s3:*
@@ -261,6 +263,8 @@ Resources:
261263 Type : AWS::S3::Bucket
262264 Properties :
263265 Tags : []
266+ VersioningConfiguration :
267+ Status : Enabled
264268
265269 OutputBucket :
266270 Type : AWS::S3::Bucket
@@ -276,7 +280,8 @@ Resources:
276280 KMSKey :
277281 Type : AWS::KMS::Key
278282 Properties :
279- Description : AWS KWS key to encrypt and decrypt SSH keys stored in S3.
283+ Description : AWS KWS key to encrypt and decrypt SSH keys stored in S3.
284+ EnableKeyRotation : true
280285 KeyPolicy :
281286 Version : ' 2012-10-17'
282287 Statement :
@@ -336,7 +341,7 @@ Resources:
336341 Condition :
337342 Bool :
338343 kms:GrantIsForAWSResource : true
339-
344+
340345 CreateSSHKeyRole :
341346 Type : AWS::IAM::Role
342347 Properties :
@@ -382,8 +387,8 @@ Resources:
382387 - logs:CreateLogStream
383388 - logs:PutLogEvents
384389 Resource :
385- - arn:aws :logs:*:*:*
386-
390+ - !Sub arn:${AWS::Partition} :logs:*:*:*
391+
387392 CreateSSHKeyLambda :
388393 DependsOn : CopyZips
389394 Type : AWS::Lambda::Function
@@ -396,7 +401,7 @@ Resources:
396401 Code :
397402 S3Bucket : !Ref 'LambdaZipsBucket'
398403 S3Key : !Sub '${QSS3KeyPrefix}functions/packages/CreateSSHKey/lambda.zip'
399-
404+
400405 CreateSSHKey :
401406 Type : AWS::CloudFormation::CustomResource
402407 Version : ' 1.0'
@@ -405,7 +410,7 @@ Resources:
405410 KeyBucket : !Ref 'KeyBucket'
406411 Region : !Ref 'AWS::Region'
407412 KMSKey : !Ref 'KMSKey'
408-
413+
409414 DeleteBucketContentsRole :
410415 Type : AWS::IAM::Role
411416 Properties :
@@ -451,7 +456,7 @@ Resources:
451456 - logs:PutLogEvents
452457 Resource :
453458 - arn:aws:logs:*:*:*
454-
459+
455460 DeleteBucketContentsLambda :
456461 DependsOn : CopyZips
457462 Type : AWS::Lambda::Function
@@ -464,7 +469,7 @@ Resources:
464469 Code :
465470 S3Bucket : !Ref 'LambdaZipsBucket'
466471 S3Key : !Sub '${QSS3KeyPrefix}functions/packages/DeleteBucketContents/lambda.zip'
467-
472+
468473 DeleteBucketContents :
469474 Type : AWS::CloudFormation::CustomResource
470475 Version : ' 1.0'
@@ -484,13 +489,13 @@ Resources:
484489 Statement :
485490 - Effect : " Allow"
486491 Principal :
487- Service : " codebuild.amazonaws.com"
488- Action :
492+ Service : " codebuild.amazonaws.com"
493+ Action :
489494 - " sts:AssumeRole"
490495 Path : " /"
491496 ManagedPolicyArns :
492497 - !Ref CodeBuildEndpointPolicy
493- Tags :
498+ Tags :
494499 -
495500 Key : ' tagging-policy'
496501 Value : !Join ['-', ["test", "ok"]]
@@ -500,13 +505,13 @@ Resources:
500505 Properties :
501506 Description : Policy with base permissions for CodeBuild.
502507 Path : /
503- Roles :
508+ Roles :
504509 - !Ref CodeBuildServiceRole
505510 PolicyDocument :
506511 Version : 2012-10-17
507512 Statement :
508513 - Effect : " Allow"
509- Action :
514+ Action :
510515 - " logs:CreateLogGroup"
511516 - " logs:PutLogEvents"
512517 - " logs:CreateLogStream"
@@ -680,7 +685,7 @@ Resources:
680685 - mv ./enc_key.pem ~/.ssh/id_rsa
681686 - ls ~/.ssh/
682687 - echo "Setting SSH config profile"
683- - |
688+ - |
684689 cat > ~/.ssh/config <<EOF
685690 Host *
686691 AddKeysToAgent yes
@@ -695,7 +700,7 @@ Resources:
695700 - |
696701 if [ "$exclude_git" = "True" ]; then
697702 zip -r $outputbucketkey ./ -x '*.git*'
698- else
703+ else
699704 zip -r $outputbucketkey ./
700705 fi
701706 - ls -alh
0 commit comments