Reputation: 16673
I having issues creating an AWS log group that belongs to a bigger CloudFormation template. So just for testing, I'm creating just the log group with the following template
Parameters:
LogGroupName:
Type: String
Description: 'cloudwatch log group name'
Default: "test-log-group"
LogGroupRetention:
Type: Number
Description: Retention period for log groups in cloudwatch
Default: 30
DelPolicy:
Type: String
Description: 'Deletion policy'
Default: "Retain"
Resources:
LLGO1WY:
Type: 'AWS::Logs::LogGroup'
Properties:
awslogs-region: !Ref 'AWS::Region'
LogGroupName: !Ref LogGroupName
RetentionInDays: !Ref LogGroupRetention
DeletionPolicy: !Ref DelPolicy
When I import the template during the manual stack creation ("Create Stack" button), I get the following when I get to the "Import Overview" page.
There was an error creating this change set
The following resources to import [LLGO1WY] must have DeletionPolicy attribute specified in the template.
If you look the documentation for AWS::Logs::LogGroup, it doesn't even have a DeletionPolicy
defined as a property. Note that if I remove that property, I get the same error. Any clues?
Upvotes: 2
Views: 4224
Reputation: 238139
AWS::Logs::LogGroup does not have DeletionPolicy
property. DeletionPolicy is a top level attribute which you can't parametrize.
I guess you wanted maybe:
Resources:
LLGO1WY:
Type: 'AWS::Logs::LogGroup'
DeletionPolicy: Retain # <--- This is not property and must be here
Properties:
awslogs-region: !Ref 'AWS::Region'
LogGroupName: !Ref LogGroupName
RetentionInDays: !Ref LogGroupRetention
Upvotes: 2