CloudFormation format problems - with DependsOnand If

0

Hi there,

i am trying to use If with DependsOn

here is the error Template format error: DependsOn must be a string or list of strings.

RealiteParkingCloudFrontDistribution:
    Type: AWS::CloudFront::Distribution
    DependsOn:
      !If
        - IsNotDev
        -
          - webLogs
          - webApp
        -
          - webApp

can you help me to fix it?

Thanks fore your help

asked 2 years ago222 views
1 Answer
1
Accepted Answer

You could try using both a condition and dependency on your resource, though you would have to duplicate it (in a way):

RealiteParkingCloudFrontDistributionForProd:
    Type: AWS::CloudFront::Distribution
    DependsOn: webApp
    Condition: IsProd

RealiteParkingCloudFrontDistributionForDev:
    Type: AWS::CloudFront::Distribution
    DependsOn: webLogs
    Condition: IsDev
AWS
EXPERT
Raphael
answered 2 years 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

Relevant content