0

Ich versuche, eine Wolkenbildung Vorlage für eine Route53 Private Hosted Zone zu schaffen, wo Listen von VPC und Regionen, dass die PHZ zugeordnet ist, als Parameter geliefert werdenRoute53 Privat Hosted Zone Parametrierter Liste der VPC

VPCIds: 
    Type: List<AWS::EC2::VPC::Id> 
    Description: The Evertz VPC Id 

    Regions: 
    Type: CommaDelimitedList 
    Description: A list that containing the matching regions for the VPCs given 

    NumberOfVPC: 
    Type: Number 

Ich habe Bedingungen für die Angabe der Anzahl der VPCs eingerichtet.

Conditions: 
    2VPC: !Or [ 
    !Equals [!Ref NumberOfVPC, 2], 
    Condition: 3VPC, 
    Condition: 4VPC, 
    Condition: 5VPC, 
    Condition: 6VPC, 
    Condition: 7VPC, 
    Condition: 8VPC 
    ] 
    3VPC: !Or [ 
    !Equals [!Ref NumberOfVPC, 3], 
    Condition: 4VPC, 
    Condition: 5VPC, 
    Condition: 6VPC, 
    Condition: 7VPC, 
    Condition: 8VPC 
    ]... 

leider habe ich nicht in der Lage gewesen, die Liste der HostedZoneVPCs

zu schaffen

Ich hatte gehofft, diese Bedingungen verwenden AWS :: NoValue zu beim Erstellen der Liste

Route53PrivateHostedZone: 
    Type: "AWS::Route53::HostedZone" 
    Properties: 
     Name: !Ref ZoneName 
     HostedZoneConfig: 
     Comment: String 
     HostedZoneTags: 
     - Key: Name 
      Value: Hosted Zone 
     VPCs: 
     - 
      VPCId: !If [2VPC, !Ref "AWS::NoValue", !Select [0, !Ref VPCIds]] 
      VPCRegion: !If [2VPC, !Ref "AWS::NoValue", !Select [0, !Ref Regions]] 

     VPCs: 
     - VPCId: !If [2VPC, !Select [0, !Ref VPCIds], !Ref "AWS::NoValue"] 
      VPCRegion: !If [2VPC, !Select [0, !Ref Regions], !Ref "AWS::NoValue"] 

     - VPCId: !If [2VPC, !Select [1, !Ref VPCIds], !Ref "AWS::NoValue"] 
      VPCRegion: !If [2VPC, !Select [1, !Ref Regions], !Ref "AWS::NoValue"] 

jedoch zu liefern Dies funktioniert nicht und die Hosted Zone kann nicht erstellt werden.

Gibt es eine Möglichkeit innerhalb Cloudformation, die ich die Liste des HostedZoneVPCs konstruieren kann die xVPC Bedingungen mit denen ich angelegt habe?

Antwort

0

Die Lösung, die ich zur Zeit gefunden habe, ist zu nisten !If und hier verwenden auf die nächste VPC/Region Liste zu fallen ist die Zählung nicht viel kostet. Ändern Sie auch die Bedingungen, sodass sie nicht kumulativ sind.

Conditions: 
    1VPC: !Equals [!Ref NumberOfVPC, 1] 
    2VPC: !Equals [!Ref NumberOfVPC, 2] 
    3VPC: !Equals [!Ref NumberOfVPC, 3] 
    4VPC: !Equals [!Ref NumberOfVPC, 4] 
    5VPC: !Equals [!Ref NumberOfVPC, 5] 
    6VPC: !Equals [!Ref NumberOfVPC, 6] 
    7VPC: !Equals [!Ref NumberOfVPC, 7] 
    8VPC: !Equals [!Ref NumberOfVPC, 8] 

und die VPCs-Eigenschaft wird dann;

VPCs: 
    !If [1VPC, 
    [ 
     {VPCId: !Select [0, !Ref VPCIds], VPCRegion: !Select [0, !Ref Regions]} 
    ], 
     !If [2VPC, 
     [ 
     {VPCId: !Select [0, !Ref VPCIds], VPCRegion: !Select [0, !Ref Regions]}, 
     {VPCId: !Select [1, !Ref VPCIds], VPCRegion: !Select [1, !Ref Regions]} 
     ], 
     !If [3VPC, 
     [ 
      {VPCId: !Select [0, !Ref VPCIds], VPCRegion: !Select [0, !Ref Regions]}, 
      {VPCId: !Select [1, !Ref VPCIds], VPCRegion: !Select [1, !Ref Regions]}, 
      {VPCId: !Select [2, !Ref VPCIds], VPCRegion: !Select [2, !Ref Regions]} 
     ], 
      !If [4VPC, 
      [ 
      {VPCId: !Select [0, !Ref VPCIds], VPCRegion: !Select [0, !Ref Regions]}, 
      {VPCId: !Select [1, !Ref VPCIds], VPCRegion: !Select [1, !Ref Regions]}, 
      {VPCId: !Select [2, !Ref VPCIds], VPCRegion: !Select [2, !Ref Regions]}, 
      {VPCId: !Select [3, !Ref VPCIds], VPCRegion: !Select [3, !Ref Regions]} 
      ], 
      !If [5VPC, 
      [ 
       {VPCId: !Select [0, !Ref VPCIds], VPCRegion: !Select [0, !Ref Regions]}, 
       {VPCId: !Select [1, !Ref VPCIds], VPCRegion: !Select [1, !Ref Regions]}, 
       {VPCId: !Select [2, !Ref VPCIds], VPCRegion: !Select [2, !Ref Regions]}, 
       {VPCId: !Select [3, !Ref VPCIds], VPCRegion: !Select [3, !Ref Regions]}, 
       {VPCId: !Select [4, !Ref VPCIds], VPCRegion: !Select [4, !Ref Regions]} 
      ], 
       !If [6VPC, 
       [ 
       {VPCId: !Select [0, !Ref VPCIds], VPCRegion: !Select [0, !Ref Regions]}, 
       {VPCId: !Select [1, !Ref VPCIds], VPCRegion: !Select [1, !Ref Regions]}, 
       {VPCId: !Select [2, !Ref VPCIds], VPCRegion: !Select [2, !Ref Regions]}, 
       {VPCId: !Select [3, !Ref VPCIds], VPCRegion: !Select [3, !Ref Regions]}, 
       {VPCId: !Select [4, !Ref VPCIds], VPCRegion: !Select [4, !Ref Regions]}, 
       {VPCId: !Select [5, !Ref VPCIds], VPCRegion: !Select [5, !Ref Regions]} 
       ], 
       !If [7VPC, 
       [ 
        {VPCId: !Select [0, !Ref VPCIds], VPCRegion: !Select [0, !Ref Regions]}, 
        {VPCId: !Select [1, !Ref VPCIds], VPCRegion: !Select [1, !Ref Regions]}, 
        {VPCId: !Select [2, !Ref VPCIds], VPCRegion: !Select [2, !Ref Regions]}, 
        {VPCId: !Select [3, !Ref VPCIds], VPCRegion: !Select [3, !Ref Regions]}, 
        {VPCId: !Select [4, !Ref VPCIds], VPCRegion: !Select [4, !Ref Regions]}, 
        {VPCId: !Select [5, !Ref VPCIds], VPCRegion: !Select [5, !Ref Regions]}, 
        {VPCId: !Select [6, !Ref VPCIds], VPCRegion: !Select [6, !Ref Regions]} 
       ], 
        !If [8VPC, 
        [ 
        {VPCId: !Select [0, !Ref VPCIds], VPCRegion: !Select [0, !Ref Regions]}, 
        {VPCId: !Select [1, !Ref VPCIds], VPCRegion: !Select [1, !Ref Regions]}, 
        {VPCId: !Select [2, !Ref VPCIds], VPCRegion: !Select [2, !Ref Regions]}, 
        {VPCId: !Select [3, !Ref VPCIds], VPCRegion: !Select [3, !Ref Regions]}, 
        {VPCId: !Select [4, !Ref VPCIds], VPCRegion: !Select [4, !Ref Regions]}, 
        {VPCId: !Select [5, !Ref VPCIds], VPCRegion: !Select [5, !Ref Regions]}, 
        {VPCId: !Select [6, !Ref VPCIds], VPCRegion: !Select [6, !Ref Regions]}, 
        {VPCId: !Select [7, !Ref VPCIds], VPCRegion: !Select [7, !Ref Regions]} 
        ], 
        !Ref "AWS::NoValue" 
        ] 
       ] 
       ] 
      ] 
      ] 
     ] 
     ] 
    ] 
Verwandte Themen