ttl stack
parent
4f4f226af6
commit
dcbe1c3b48
|
|
@ -13,6 +13,9 @@ Metadata:
|
||||||
default: Stack name
|
default: Stack name
|
||||||
TTL:
|
TTL:
|
||||||
default: Time-to-live
|
default: Time-to-live
|
||||||
|
BUILDID:
|
||||||
|
Type: String
|
||||||
|
Default: ''
|
||||||
Parameters:
|
Parameters:
|
||||||
StackName:
|
StackName:
|
||||||
Type: String
|
Type: String
|
||||||
|
|
@ -22,6 +25,7 @@ Parameters:
|
||||||
Description: Time-to-live in minutes for the stack.
|
Description: Time-to-live in minutes for the stack.
|
||||||
Resources:
|
Resources:
|
||||||
DeleteCFNLambdaExecutionRole:
|
DeleteCFNLambdaExecutionRole:
|
||||||
|
Name: !Join [ "", [ 'DeleteCFNLambdaExecutionRole', !Ref BUILDID ] ]
|
||||||
Type: "AWS::IAM::Role"
|
Type: "AWS::IAM::Role"
|
||||||
Properties:
|
Properties:
|
||||||
AssumeRolePolicyDocument:
|
AssumeRolePolicyDocument:
|
||||||
|
|
@ -48,6 +52,7 @@ Resources:
|
||||||
- "cloudformation:DeleteStack"
|
- "cloudformation:DeleteStack"
|
||||||
Resource: !Sub "arn:aws:cloudformation:${AWS::Region}:${AWS::AccountId}:stack/${StackName}/*"
|
Resource: !Sub "arn:aws:cloudformation:${AWS::Region}:${AWS::AccountId}:stack/${StackName}/*"
|
||||||
DeleteCFNLambda:
|
DeleteCFNLambda:
|
||||||
|
Name: !Join [ "", [ 'DeleteCFNLambda', !Ref BUILDID ] ]
|
||||||
Type: "AWS::Lambda::Function"
|
Type: "AWS::Lambda::Function"
|
||||||
DependsOn:
|
DependsOn:
|
||||||
- DeleteCFNLambdaExecutionRole
|
- DeleteCFNLambdaExecutionRole
|
||||||
|
|
@ -82,6 +87,7 @@ Resources:
|
||||||
Timeout: "5"
|
Timeout: "5"
|
||||||
Role: !GetAtt DeleteCFNLambdaExecutionRole.Arn
|
Role: !GetAtt DeleteCFNLambdaExecutionRole.Arn
|
||||||
DeleteStackEventRule:
|
DeleteStackEventRule:
|
||||||
|
Name: !Join [ "", [ 'DeleteStackEventRule', !Ref BUILDID ] ]
|
||||||
DependsOn:
|
DependsOn:
|
||||||
- DeleteCFNLambda
|
- DeleteCFNLambda
|
||||||
- GenerateCronExpression
|
- GenerateCronExpression
|
||||||
|
|
@ -95,6 +101,7 @@ Resources:
|
||||||
Arn: !GetAtt DeleteCFNLambda.Arn
|
Arn: !GetAtt DeleteCFNLambda.Arn
|
||||||
Id: 'DeleteCFNLambda'
|
Id: 'DeleteCFNLambda'
|
||||||
PermissionForDeleteCFNLambda:
|
PermissionForDeleteCFNLambda:
|
||||||
|
Name: !Join [ "", [ 'PermissionForDeleteCFNLambda', !Ref BUILDID ] ]
|
||||||
Type: "AWS::Lambda::Permission"
|
Type: "AWS::Lambda::Permission"
|
||||||
Properties:
|
Properties:
|
||||||
FunctionName: !Sub "arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:DeleteCFNLambda-${StackName}"
|
FunctionName: !Sub "arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:DeleteCFNLambda-${StackName}"
|
||||||
|
|
@ -102,6 +109,7 @@ Resources:
|
||||||
Principal: "events.amazonaws.com"
|
Principal: "events.amazonaws.com"
|
||||||
SourceArn: !GetAtt DeleteStackEventRule.Arn
|
SourceArn: !GetAtt DeleteStackEventRule.Arn
|
||||||
BasicLambdaExecutionRole:
|
BasicLambdaExecutionRole:
|
||||||
|
Name: !Join [ "", [ 'BasicLambdaExecutionRole', !Ref BUILDID ] ]
|
||||||
Type: "AWS::IAM::Role"
|
Type: "AWS::IAM::Role"
|
||||||
Properties:
|
Properties:
|
||||||
AssumeRolePolicyDocument:
|
AssumeRolePolicyDocument:
|
||||||
|
|
@ -124,6 +132,7 @@ Resources:
|
||||||
- "logs:PutLogEvents"
|
- "logs:PutLogEvents"
|
||||||
Resource: "arn:aws:logs:*:*:*"
|
Resource: "arn:aws:logs:*:*:*"
|
||||||
GenerateCronExpLambda:
|
GenerateCronExpLambda:
|
||||||
|
Name: !Join [ "", [ 'GenerateCronExpLambda', !Ref BUILDID ] ]
|
||||||
Type: "AWS::Lambda::Function"
|
Type: "AWS::Lambda::Function"
|
||||||
Properties:
|
Properties:
|
||||||
Code:
|
Code:
|
||||||
|
|
@ -166,6 +175,7 @@ Resources:
|
||||||
Role: !GetAtt BasicLambdaExecutionRole.Arn
|
Role: !GetAtt BasicLambdaExecutionRole.Arn
|
||||||
|
|
||||||
GenerateCronExpression:
|
GenerateCronExpression:
|
||||||
|
Name: !Join [ "", [ 'GenerateCronExpression', !Ref BUILDID ] ]
|
||||||
Type: "Custom::GenerateCronExpression"
|
Type: "Custom::GenerateCronExpression"
|
||||||
Version: "1.0"
|
Version: "1.0"
|
||||||
Properties:
|
Properties:
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -276,7 +276,6 @@ class AWS {
|
||||||
|
|
||||||
try{
|
try{
|
||||||
await CF.waitFor('stackCreateComplete', { StackName: taskDefStackName }).promise();
|
await CF.waitFor('stackCreateComplete', { StackName: taskDefStackName }).promise();
|
||||||
await CF.waitFor('stackCreateComplete', { StackName: taskDefStackName+"-ttl" }).promise();
|
|
||||||
}catch(error){
|
}catch(error){
|
||||||
core.error(error);
|
core.error(error);
|
||||||
}
|
}
|
||||||
|
|
@ -379,6 +378,8 @@ class AWS {
|
||||||
.promise()
|
.promise()
|
||||||
).ShardIterator;
|
).ShardIterator;
|
||||||
|
|
||||||
|
await CF.waitFor('stackCreateComplete', { StackName: taskDefStackName+"-ttl" }).promise();
|
||||||
|
|
||||||
core.info(`Task status is ${await getTaskStatus()}`);
|
core.info(`Task status is ${await getTaskStatus()}`);
|
||||||
|
|
||||||
const logBaseUrl = `https://console.aws.amazon.com/cloudwatch/home?region=${SDK.config.region}#logsV2:log-groups/${taskDefStackName}`;
|
const logBaseUrl = `https://console.aws.amazon.com/cloudwatch/home?region=${SDK.config.region}#logsV2:log-groups/${taskDefStackName}`;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue