0

I am trying to specify subnets for ELB based on the region type This is what i have in my parameters for example

PublicSubnetsEastRegion:
  Description: List of public subnets in us-west-2 region 
  Default: 'subnet-0bc21846adc3391fa,subnet-044a6f3e47331f209,subnet-0277131ad616e1b50'
  Type: 'List<String>'

This is how i am referencing in ELB

BastionELB:
    Type: AWS::ElasticLoadBalancing::LoadBalancer
    Properties: 

      ConnectionDrainingPolicy: 
        Enabled: !Ref ELBConfigConnectionDraining
        Timeout: !Ref ELBConfigConnectionDrainingTimeout

      SecurityGroups: 
        - !Ref BastionClientsdevELBIntuitSecurityGroup

      Subnets:
        - !If [ isRegionUS-WEST-2, !Ref PublicSubnetsWestRegion, !Ref PublicSubnetsEastRegion ]

But this keeps throwing the error subnets have to be of list type. How can i refer them in ELB based on the condition(that determines the region)

1 Answer 1

1

You do not need -. It should be:

   Subnets:
      !If [ isRegionUS-WEST-2, !Ref PublicSubnetsWestRegion, !Ref PublicSubnetsEastRegion ]

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.