AWS-Cloudformation-Fn :: Equals错误,条件只能是对参数和其他条件的布尔运算

时间:2019-09-20 21:10:52

标签: conditional-statements amazon-cloudformation

我正在尝试根据环境创建ACL,并且具有以下条件。

Global: 
Env: stage 
Region: us-west -1 

Conditions:
  IsStage:  Fn::Equals [!Ref "Env", "stage"]

Resources:

publicIngressVpc:
    Type: AWS::EC2::NetworkAclEntry
    Condition: IsStage
    Properties:
      NetworkAclId:
        Fn::ImportValue:
          !Sub ${VpcStack}-publicNetworkAclId
      RuleNumber: 150
      Protocol: -1 # tcp
      RuleAction: allow
      CidrBlock: Some VPC
      PortRange:
        From: 1024
        To: 65535

我遇到以下错误:

Template format error: Conditions can only be boolean operations on parameters and other conditions

1 个答案:

答案 0 :(得分:0)

尝试以下方法:

Conditions:
  IsStage:  
    !Equals [ !Ref Env, 'stage' ]