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.

asked 2 years ago245 views
1 Answer
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
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions