copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

got an error when delete static site

Open psYifanChen opened this issue 1 year ago • 4 comments

Hello! I'm using static site and add a s3 bucket to store output of Athena. Got an error when trying to delete svc.

clean resources: get bucket name: more than one S3 bucket with tags "copilot-application"="my-app","copilot-environment"

here is part of my addons

Resources:
  # other stuffs
  AthenaResultBucket:
    Type: AWS::S3::Bucket
    DeletionPolicy: Retain
    Properties:
      BucketEncryption:
        ServerSideEncryptionConfiguration:
          - ServerSideEncryptionByDefault:
              SSEAlgorithm: AES256
      BucketName: !Sub
        - '${App}-${Env}-athena-result-bucket-${BucketNameSuffix}'
        - BucketNameSuffix: !Select [ 0, !Split [ "-", !Select [ 2, !Split [ "/", !Ref AWS::StackId ] ] ] ]
      AccessControl: Private
      PublicAccessBlockConfiguration:
        BlockPublicAcls: true
        BlockPublicPolicy: true
        IgnorePublicAcls: true
        RestrictPublicBuckets: true

copilot version: 1.33.1

psYifanChen avatar Mar 06 '24 04:03 psYifanChen

Hello @psYifanChen. Is AthenaResultBucket an addons resource of the static site service? So both AthenaResultBucket and the static site bucket have the same tag set?

iamhopaul123 avatar Mar 06 '24 05:03 iamhopaul123

@iamhopaul123 Yes, it's addons resources. Both two buckets has the same tag.

psYifanChen avatar Mar 06 '24 07:03 psYifanChen

Gotcha. Sorry for the inconvenience but as a temporary workaround, can you set https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucket.html#cfn-s3-bucket-tags so that AthenaResultBucket gets a different tag value for either one of copilot-application or copilot-environment?

iamhopaul123 avatar Mar 06 '24 07:03 iamhopaul123

@iamhopaul123 Okay, I'll do this for now.

psYifanChen avatar Mar 06 '24 08:03 psYifanChen