gpt4 book ai didi

amazon-web-services - 仅当实体尚不存在时,我可以在 CloudFormation 中设置属性吗?

转载 作者:行者123 更新时间:2023-12-03 07:20:31 29 4
gpt4 key购买 nike

我通过 Amplify 有一个 CloudFormation,它定义了 Cognito 用户池。我想将从此模板部署的 future 环境设置为具有 UsernameConfiguration.CaseSensitive: False。如果我只是将该属性添加到我的 CloudFormation 模板中,更新将失败并出现以下错误:

Reason: Updates are not allowed for property - UsernameConfiguration. (Service: AWSCognitoIdentityProvider; Status Code: 400; Error Code: InvalidParameterException; Request ID: null; Proxy: null)

有没有办法根据池是否已存在来确定此属性?我希望创建的任何新环境都使用新配置,但仍允许部署旧环境。

以下是 Amplify 用于创建用户池的 CloudFormation 模板的片段。

    # BEGIN USER POOL RESOURCES
UserPool:
# Created upon user selection
# Depends on SNS Role for Arn if MFA is enabled
Type: AWS::Cognito::UserPool
UpdateReplacePolicy: Retain
Properties:
UserPoolName:
!If [
ShouldNotCreateEnvResources,
!Ref userPoolName,
!Join ["", [!Ref userPoolName, "-", !Ref env]],
]

Schema:
- Name: email
Required: true
Mutable: true

LambdaConfig:
PostAuthentication: !Ref functiontestcd9b6b5ePostAuthenticationArn

PostConfirmation: !Ref functiontestcd9b6b5ePostConfirmationArn

PreTokenGeneration: !Ref functiontestcd9b6b5ePreTokenGenerationArn

AutoVerifiedAttributes: !Ref autoVerifiedAttributes

EmailVerificationMessage: !Ref emailVerificationMessage
EmailVerificationSubject: !Ref emailVerificationSubject

Policies:
PasswordPolicy:
MinimumLength: !Ref passwordPolicyMinLength
RequireLowercase: false
RequireNumbers: false
RequireSymbols: false
RequireUppercase: false

UsernameAttributes: !Ref usernameAttributes

MfaConfiguration: !Ref mfaConfiguration
SmsVerificationMessage: !Ref smsVerificationMessage
SmsAuthenticationMessage: !Ref smsAuthenticationMessage
SmsConfiguration:
SnsCallerArn: !GetAtt SNSRole.Arn
ExternalId: testcd9b6b5e_role_external_id
UsernameConfiguration:
CaseSensitive: False

最佳答案

Is there a way to condition this property on whether the pool already exists?

遗憾的是,它不可能,因为 CFN 没有检查池是否存在的功能。如果您需要此类功能,则必须使用 custom resource 自行实现。 .

关于amazon-web-services - 仅当实体尚不存在时,我可以在 CloudFormation 中设置属性吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67944236/

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