【发布时间】:2021-10-12 03:16:11
【问题描述】:
我在创建属于更大 CloudFormation 模板的 AWS 日志组时遇到问题。所以只是为了测试,我只使用以下模板创建日志组
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
当我在手动创建堆栈(“创建堆栈”按钮)期间导入模板时,当我进入“导入概述”页面时,我得到以下信息。
There was an error creating this change set
The following resources to import [LLGO1WY] must have DeletionPolicy attribute specified in the template.
如果您查看documentation for AWS::Logs::LogGroup,它甚至没有将DeletionPolicy 定义为属性。请注意,如果我删除该属性,我会得到同样的错误。有什么线索吗?
【问题讨论】:
-
为什么要“导入”模板?只有在尝试将现有资源放入堆栈时才应该使用它:Bringing existing resources into CloudFormation management - AWS CloudFormation
标签: amazon-web-services amazon-cloudformation