[英]Is there a way to modularize cloudformation template?
现在我正在以这种方式使用模板:
这很无聊,因为我必须分三步部署堆栈,并根据资源进行注释。
我读过有关 cloudformation 模块的信息,但它们似乎无法解决将 3 步过程(初始化、导入现有、使用现有)合并到单个 cloudformation 模板中的问题。
这种情况有解决办法吗?
UPD:我知道我可以只使用资源 ARN 来引用现有资源而不导入它们,但这并不能解决我需要将其他内容附加到我的资源的情况(在这里我创建了导入的 S3 存储桶的事件通知):
# Import existing resource
S3DataBucket:
Type: AWS::S3::Bucket
DeletionPolicy: Retain
# Modify template by adding event configuration
S3DataBucket:
Type: AWS::S3::Bucket
DeletionPolicy: Retain
Properties:
NotificationConfiguration:
LambdaConfigurations:
- Event: s3:ObjectCreated:Put
Filter:
S3Key:
Rules:
- Name: prefix
Value: !Ref SomePrefix
Function: !GetAtt SomeLambda.Arn
看起来有一个 issue open for this,但 AWS 对修复它不太感兴趣: https://github.com/aws-cloudformation/cloudformation-coverage-roadmap/issues/79
同时,您可以考虑以下几点:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.