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

已提問 2 年前檢視次數 237 次
1 個回答
1
已接受的答案

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
專家
Raphael
已回答 2 年前

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

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

回答問題指南