From 2a0e93082a8a19cf5074b0a3a043cf7f026073ee Mon Sep 17 00:00:00 2001 From: mdugdale Date: Thu, 11 Mar 2021 22:21:06 +0000 Subject: [PATCH] ttl stack --- action/cloudformation-stack-ttl.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/action/cloudformation-stack-ttl.yml b/action/cloudformation-stack-ttl.yml index ae2cd7d6..567b6f23 100644 --- a/action/cloudformation-stack-ttl.yml +++ b/action/cloudformation-stack-ttl.yml @@ -25,9 +25,9 @@ Parameters: Description: Time-to-live in minutes for the stack. Resources: DeleteCFNLambdaExecutionRole: - Name: !Join [ "", [ 'DeleteCFNLambdaExecutionRole', !Ref BUILDID ] ] Type: "AWS::IAM::Role" Properties: + Name: !Join [ "", [ 'DeleteCFNLambdaExecutionRole', !Ref BUILDID ] ] AssumeRolePolicyDocument: Version: "2012-10-17" Statement: @@ -52,11 +52,11 @@ Resources: - "cloudformation:DeleteStack" Resource: !Sub "arn:aws:cloudformation:${AWS::Region}:${AWS::AccountId}:stack/${StackName}/*" DeleteCFNLambda: - Name: !Join [ "", [ 'DeleteCFNLambda', !Ref BUILDID ] ] Type: "AWS::Lambda::Function" DependsOn: - DeleteCFNLambdaExecutionRole Properties: + Name: !Join [ "", [ 'DeleteCFNLambda', !Ref BUILDID ] ] FunctionName: !Sub "DeleteCFNLambda-${StackName}" Code: ZipFile: | @@ -87,12 +87,12 @@ Resources: Timeout: "5" Role: !GetAtt DeleteCFNLambdaExecutionRole.Arn DeleteStackEventRule: - Name: !Join [ "", [ 'DeleteStackEventRule', !Ref BUILDID ] ] DependsOn: - DeleteCFNLambda - GenerateCronExpression Type: "AWS::Events::Rule" Properties: + Name: !Join [ "", [ 'DeleteStackEventRule', !Ref BUILDID ] ] Description: Delete stack event ScheduleExpression: !GetAtt GenerateCronExpression.cron_exp State: "ENABLED" @@ -101,17 +101,17 @@ Resources: Arn: !GetAtt DeleteCFNLambda.Arn Id: 'DeleteCFNLambda' PermissionForDeleteCFNLambda: - Name: !Join [ "", [ 'PermissionForDeleteCFNLambda', !Ref BUILDID ] ] Type: "AWS::Lambda::Permission" Properties: + Name: !Join [ "", [ 'PermissionForDeleteCFNLambda', !Ref BUILDID ] ] FunctionName: !Sub "arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:DeleteCFNLambda-${StackName}" Action: "lambda:InvokeFunction" Principal: "events.amazonaws.com" SourceArn: !GetAtt DeleteStackEventRule.Arn BasicLambdaExecutionRole: - Name: !Join [ "", [ 'BasicLambdaExecutionRole', !Ref BUILDID ] ] Type: "AWS::IAM::Role" Properties: + Name: !Join [ "", [ 'BasicLambdaExecutionRole', !Ref BUILDID ] ] AssumeRolePolicyDocument: Version: "2012-10-17" Statement: @@ -132,9 +132,9 @@ Resources: - "logs:PutLogEvents" Resource: "arn:aws:logs:*:*:*" GenerateCronExpLambda: - Name: !Join [ "", [ 'GenerateCronExpLambda', !Ref BUILDID ] ] Type: "AWS::Lambda::Function" Properties: + Name: !Join [ "", [ 'GenerateCronExpLambda', !Ref BUILDID ] ] Code: ZipFile: | from datetime import datetime, timedelta @@ -175,9 +175,9 @@ Resources: Role: !GetAtt BasicLambdaExecutionRole.Arn GenerateCronExpression: - Name: !Join [ "", [ 'GenerateCronExpression', !Ref BUILDID ] ] Type: "Custom::GenerateCronExpression" Version: "1.0" Properties: + Name: !Join [ "", [ 'GenerateCronExpression', !Ref BUILDID ] ] ServiceToken: !GetAtt GenerateCronExpLambda.Arn ttl: !Ref 'TTL'