Home > Software engineering >  Unable to resolve cloudformation template using !Sub
Unable to resolve cloudformation template using !Sub

Time:02-10

I am trying to keep apigateway DNS values in ssm parameter section .The way I used the function Select it is just printing in SSM .apiEndpoint is another resources which is working fine .Could someone please help me in Value section so that I can keep the DNS name in ssm parameter .

  APIGWEndpointSSM:
    Type: AWS::SSM::Parameter
    Properties :
      Description : vpc endpoint for the nextgen apigateway.
      Name : /vpc/apigwvpcendpoint
      Type : String
      Value : https://!Sub(!Select [1, !Split [":", !Select [ 0, !GetAtt apiEndpoint.DnsEntries ]]])

CodePudding user response:

You can use array form of Sub:

Name: !Sub
  - "https://${dns}"
  - { dns: !Select [1, !Split [":", !Select [ 0, !GetAtt apiEndpoint.DnsEntries]]] }
  • Related