Cloudformation rule doesn't prevent stack creation

0

Hi,

Our cloudformation template requires user to enter the email, password and then confirm the password before creating the stack. We have cloudformation rule to check whether the password field and confirm password field are the same:

Rules:
  ConfirmPasswordsMatch:
    Assertions:
      - Assert:
          Fn::Equals:
            - !Ref AdminPassword
            - !Ref ConfirmAdminPassword
        AssertDescription: Passwords do not match

While it does render an error message below the password input field when two passwords are different, but it doesn't actually prevent user to create the stack. Even the password and confirm password are different, user can still successfully create the stack.

This is a blocker for us, because we want to use similar mechanism to validate other template parameters.

Using rule is the official validation mechanism , and we are doing in the same way.

已提問 2 年前檢視次數 245 次
1 個回答
0

In the console, I just tested the below template, and it worked as expected. If the fields, didn't match, I was unable to proceed, if they did I was able to create a stack from the template.

AWSTemplateFormatVersion: 2010-09-09



Parameters:

    AdminPassword:

        Type: String

    ConfirmAdminPassword:

        Type: String



Rules:

  ConfirmPasswordsMatch:

    Assertions:

      - Assert:

          Fn::Equals:

            - !Ref AdminPassword

            - !Ref ConfirmAdminPassword

        AssertDescription: Passwords do not match

        

Resources:

    myVPC:

        Type: AWS::EC2::VPC

        Properties:

            CidrBlock: 10.0.0.0/16

            EnableDnsSupport: 'true'

            EnableDnsHostnames: 'true'

            Tags:

                - Key: stack

                  Value: test
AWS
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南