我想使用 cloudformation 创建数据库代理,这是模板的一部分:
Parameters:
SecretManagerArn:
Type: CommaDelimitedList
Description: ARN of the AWS Secrets Manager secret containing DB connection parameters
Resources:
RDSProxy:
Type: AWS::RDS::DBProxy
Properties:
Auth:
- AuthScheme: SECRETS
IAMAuth: REQUIRED
SecretArn: !Ref SecretManagerArn1
- AuthScheme: SECRETS
IAMAuth: REQUIRED
SecretArn: !Ref SecretManagerArn2
DBProxyName: "supersecretname"
EngineFamily: POSTGRESQL
RequireTLS: true
RoleArn: !GetAtt IAMRole.Arn
VpcSubnetIds: !Ref VpcSubnetIds
VpcSecurityGroupIds: !Ref VpcSGIds
现在,我可以“手动”处理将 Auth block 添加到 DBProxy 资源中的 secret 数量,但我想根据我在逗号分隔列表中传递的 secret Arns 数量创建动态 block ,这可能吗?
最佳答案
在 CloudFormation 中创建动态 block 的唯一方法是您要开发自定义 macro为了那个原因。该宏采用 lambda 函数的形式,将处理和修改您的模板以添加这些动态 block 。
关于amazon-web-services - 如何根据参数中的项目数量在cloudformation上创建动态列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76624747/