我正在开发一个项目,根据开发环境,它将在 UserPoolClient 回调 URL 中显示不同的页面,但我遇到了以下错误:
Property validation failure: [Value of property {/CallbackURLs} does not match type {Array}]
我使用的代码如下,我不确定这是否是添加 if 条件的正确方法。我试图遵循 documentation但我没有 AWS 经验。
Conditions:
IsProd: !Equals [ !Ref EnvType, 'prod']
UserPoolApiClient:
Type: AWS::Cognito::UserPoolClient
Properties:
ClientName: !Sub '${AWS::StackName}-user-pool-client'
UserPoolId: !Ref UserPool
GenerateSecret: false
SupportedIdentityProviders:
- COGNITO
ExplicitAuthFlows:
- USER_PASSWORD_AUTH
CallbackURLs:
!If
- IsProd
- Fn::Sub: '{!ImportValue landing-page}'
- Fn::Sub: '{!ImportValue landing-page}/dev_welcome.html'
最佳答案
CallbackURLs
应该是一个列表:
CallbackURLs:
- !If
- IsProd
- Fn::Sub: '{!ImportValue landing-page}'
- Fn::Sub: '{!ImportValue landing-page}/dev_welcome.html'
关于amazon-web-services - 如何根据 CloudFormation 上的条件更改属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70499949/