mardi 25 juin 2019

Fn::If condition based on environment for Cloudformation Parameters

Based on the environment, I am trying to set the URL for a variable: It staging my URL should be https://staging.DNHostedZoneName , if prod - it should just be https://DNSHostedZoneName:

Here's my condition:

Conditions:
  IsEnvProd: Fn::Equals [ !Ref Env, 'prod']
  IsEnvStage: Fn::Equals [ !Ref Env, 'stage']

Here's where its been evaluated:

          Environment:
            - Name: NODE_ENV
              Value: !Ref NodeEnv
            - Fn::If:
              - IsEnvStage
              - Name: CORE_URL
                Value:
                  Fn::Join:
                    - ""
                    - - "https://"
                      - "staging"
                      - "."
                      - !Ref DnsHostedZoneName
              - Name: NCVCORE_URL
                Value:
                  Fn::Join:
                    - ""
                    - - "https://"

                      - !Ref DnsHostedZoneName

I am getting the following error:

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

Aucun commentaire:

Enregistrer un commentaire