AWSTemplateFormatVersion: 2010-09-09 Description: This CloudFormation Template invokes other templates responsible for cleaning up AWS Resources (qs-1nlegmi1j) Metadata: cfn-lint: { config: { ignore_checks: [W9006, W9002, W9003] } } Parameters: QSS3BucketName: Description: The Template Bucket Name. Type: String QSS3BucketRegion: Default: 'us-east-1' Description: 'The AWS Region where the Quick Start S3 bucket (QSS3BucketName) is hosted. When using your own bucket, you must specify this value.' Type: String QSS3KeyPrefix: Description: The Template Bucket Prefix. Type: String Bucket: Description: The Bucket which should be emptied. Type: String Repository: Description: The ECR Repository to remove. Type: String RoleArn: Description: The ARN of the Cleanup Role. Type: String Conditions: UsingDefaultBucket: !Equals [!Ref QSS3BucketName, 'aws-quickstart'] Resources: BucketCleanup: Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub - https://${S3Bucket}.s3.${S3Region}.${AWS::URLSuffix}/${QSS3KeyPrefix}templates/clean-bucket.template.yaml - S3Region: !If [UsingDefaultBucket, !Ref 'AWS::Region', !Ref QSS3BucketRegion] S3Bucket: !If [UsingDefaultBucket, !Sub '${QSS3BucketName}-${AWS::Region}', !Ref QSS3BucketName] Parameters: Bucket: !Ref Bucket ServiceToken: !Ref RoleArn RepositoryCleanup: Type: AWS::CloudFormation::Stack Properties: TemplateURL: !Sub - https://${S3Bucket}.s3.${S3Region}.${AWS::URLSuffix}/${QSS3KeyPrefix}templates/clean-repository.template.yaml - S3Region: !If [UsingDefaultBucket, !Ref 'AWS::Region', !Ref QSS3BucketRegion] S3Bucket: !If [UsingDefaultBucket, !Sub '${QSS3BucketName}-${AWS::Region}', !Ref QSS3BucketName] Parameters: Repository: !Ref Repository ServiceToken: !Ref RoleArn