amazon-web-services - 如何根据参数中的项目数量在cloudformation上创建动态列表?

标签 amazon-web-services yaml aws-cloudformation amazon-rds

我想使用 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/

相关文章:

amazon-web-services - 使用S3上传但不允许公共(public)访问

java - AWS java lambda 中的 org.postgresql.util.PSQLException : FATAL: database "<<database_name>>" does not exist,

python - 在 Cloudformation 中使用时无法从 S3 下载引导文件

amazon-web-services - 如何使用 CloudFormation 将 CloudFront 分发集成到 AWS WAF?

amazon-web-services - 配置 SQS 死信队列以在收到消息时发出云监视警报

postgresql - 我们可以将AWS RDS只读副本视为备份吗?

amazon-web-services - 如何在 terraform lambda 代码中引用在 s3 存储桶中上传的 zip 文件?

vim - 使用vim通过(增加)编号多次粘贴 block

yaml - 无服务器 - AWS S3 存储桶已存在

ruby - 从 yaml 文件中读取数据并在 ruby​​ 中生成一个数组