gpt4 book ai didi

amazon-web-services - 无法对 CloudFormation CommaDelimitedList 参数使用AllowedPattern

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

请注意,此问题与 Enforce AllowedPattern for parameter of type CommaDelimitedList in Cloudformation script 不同。 ,因为该问题是在 CommaDelimitedList 支持 AllowedPattern 之前编写的,因此显示的错误消息不同,并且接受的答案不再准确。

我有一个带有以下参数的 AWS CloudFormation 模板:

  Profiles:
Description: The comma-separated list of active profiles, such as "dev,test".
Type: CommaDelimitedList
Default: ""
AllowedPattern: '\w+'
ConstraintDescription: Active profile identifiers must only use word characters, separated by commas.

latest documentation对于 AllowedPattern 说:

When applied to a parameter of type CommaDelimitedList, the pattern must match each value in the list.

我尝试调用 aws cloudformation deploy ... 并传递 Profiles 参数:

aws cloudformation deploy … --parameter-overrides … Profiles=dev,test

这也不起作用:

aws cloudformation deploy … --parameter-overrides … Profiles="dev,test"

事实上,即使这样也行不通!

aws cloudformation deploy … --parameter-overrides … Profiles=dev

AWS CLI 告诉我:

An error occurred (ValidationError) when calling the CreateChangeSet operation: Parameter Profiles failed to satisfy constraint: Active profile identifiers must only use word characters, separated by commas.

如果我删除AllowedPattern,它就会起作用:

  Profiles:
Description: The comma-separated list of active profiles, such as "dev,test".
Type: CommaDelimitedList
Default: ""
# AllowedPattern: '\w+'
ConstraintDescription: Active profile identifiers must only use word characters, separated by commas.

如果我切换到 PowerShell 并尝试此操作,它也会失败:

aws cloudformation deploy … --parameter-overrides … Profiles=dev,test

在 PowerShell 中这也会失败:

aws cloudformation deploy … --parameter-overrides … 'Profiles=dev'

在 PowerShell 中这也失败了:

aws cloudformation deploy … --parameter-overrides '… Profiles=dev'

我开始认为,当从 CLI 调用时,AllowedPattern 只是被 CloudFormation 中的 CommaDelimitedList 破坏了。

最佳答案

事实上,CloudFormation 似乎只是被 AllowedPatternCommaDelimitedList 组合所破坏。我打开AllowedPattern broken with CommaDelimitedList parameter #7750半年前了,还没修复。

关于amazon-web-services - 无法对 CloudFormation CommaDelimitedList 参数使用AllowedPattern,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75747327/

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