gpt4 book ai didi

amazon-web-services - 如何使用 CommaDelimitedList 参数创建资源 ARNS 列表?

转载 作者:行者123 更新时间:2023-12-03 07:19:55 26 4
gpt4 key购买 nike

我正在尝试创建一个 Cloudwatch 事件规则,它将使用多个 Codepipelines 作为源和触发器目标。

Parameters:
SourcePipeline:
Description: Name of Source codepipeline
Type: CommaDelimitedList
Default: 'test3, test4'

Resources:
PipelineTrigger:
Type: 'AWS::Events::Rule'
Properties:
EventPattern:
source:
- aws.codepipeline
resources: !Split
- ','
- !Sub
- 'arn:aws:codepipeline:${AWS::Region}:${AWS::AccountId}:${pipeline}'
- pipeline: !Join
- ',arn:aws:codepipeline:${AWS::Region}:${AWS::AccountId}:'
- !Ref SourcePipeline

期望资源如下:

  "resources": ["arn:aws:codepipeline:us-east-1:123:test3","arn:aws:codepipeline:us-east-1:123:test4"],

知道如何将名称列表作为参数传递吗?

@FYI引用我正在关注Using Lists of ARNs

最佳答案

首先,它应该是!Ref SourcePipelines。其次你忘记了逗号。你不能按照你想要的方式做到这一点。这是因为,连接的第一个参数必须是文字字符串,而不是任何 CloudFormation 表达式或函数。因此,您必须对您的帐户 ID 和区域进行硬编码:

        resources: !Split
- ','
- !Sub
- 'arn:aws:codepipeline:${AWS::Region}:${AWS::AccountId}:${pipeline}'
- pipeline: !Join
- ',arn:aws:codepipeline:us-east-1:12312321:'
- !Ref SourcePipelines

关于amazon-web-services - 如何使用 CommaDelimitedList 参数创建资源 ARNS 列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70152313/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com