I ran into a condition that caused my stack to become unrecoverable and I had no choice but to delete it. Using the exact same template, I went ahead and created another stack with the same name.
The following resource(s) failed to create: [AdminPanelCDNAccessIdentity,
BackendLogGroup, BackendLoadBalancerSecurityGroup, AdminPanelCertificate,
EnvironmentCertificate, AdminPanelBucket, BackendECSTaskRole,
BackendECSTaskBitbucketAccess2RunTask, BackendLoadBalancerTargetGroup]. The
following resource(s) failed to update: [FrontEndBucket].
Do I really need to delete all these resources manually and rebuild them from scratch? That seems like a terrible option.
Here's a sample snippet of my template code
Resources:
FrontEndBucket:
Type: 'AWS::S3::Bucket'
Properties:
BucketName: !If
- IsProduction
- 'Fn::ImportValue': !Sub '${LandscapeStack}-DNSDomain'
- 'Fn::Sub':
- '${EnvironmentSubdomain}.${LandscapeDomain}'
- LandscapeDomain:
'Fn::ImportValue': !Sub '${LandscapeStack}-DNSDomain'
AccessControl: Private
Tags:
- Key: landscape
Value: !Ref Landscape
- Key: environment
Value: !Ref EnvironmentName
WebsiteConfiguration:
IndexDocument: index.html
Metadata:
'AWS::CloudFormation::Designer':
id: 53eb6c3a-767f-46fb-a719-2846f1fd6bdd
FrontEndBucketPolicy:
Type: 'AWS::S3::BucketPolicy'
Properties:
Bucket: !Ref FrontEndBucket
PolicyDocument:
Statement:
- Effect: Allow
Action:
- 's3:PutObject'
- 's3:GetObject'
- 's3:DeleteObject'
Resource: !Sub 'arn:aws:s3:::${FrontEndBucket}/*'
Principal:
AWS:
'Fn::ImportValue': !Sub '${CIResourcesStack}-BitbucketFrontEndPipelineUser'
- Effect: Allow
Action:
- 's3:ListBucket'
Resource: !Sub 'arn:aws:s3:::${FrontEndBucket}'
Principal:
AWS:
'Fn::ImportValue': !Sub '${CIResourcesStack}-BitbucketFrontEndPipelineUser'
- Effect: Allow
Action:
- 's3:GetObject'
Resource: !Sub 'arn:aws:s3:::${FrontEndBucket}/*'
Principal:
CanonicalUser: !GetAtt FrontEndCDNAccessIdentity.S3CanonicalUserId
Metadata:
'AWS::CloudFormation::Designer':
id: f8d2a536-790c-4cbe-adcb-b50754c0922e
Any help on this would be greatly appreciated!!
You probably selected to retain all of the resources that failed to delete when you deleted the stack. CloudFormation will not adopt existing resources into the stack. You will need to manually delete all of the resources that were created by the old stack before you can deploy this exact same stack. Or you can change the names of the resources before you deploy again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With