AWS Cloudformation Template – How to Import Values and Sub for ALB Target Group

I am creating an ALB via Cloudformation Template. One of the resources being created is a target group that will use EC2 instance ID’s that were exported during a previous job. I need to import the values and sub the import name to reflect different environment deployments. Running the cfn-lint tool, this is a correct template:

AWSTemplateFormatVersion: "2010-09-09"
Description: Creates an application load balancer.
Parameters:
  pSystem:
    Type: String
    Default: your-system-name
    Description: 'Name of the system. Default: your-system-name'
  pApp:
    Type: String
    Description: 'Name of the application solution'
  pEnvironment:
    Type: String
    Default: sbx
    Description: 'Name of the deployment tier. Default: sbx'
  pVpcId:
    Type: AWS::SSM::Parameter::Value<String>

Resources:

  rLoadBalancerTargetGroup:
    Type: AWS::ElasticLoadBalancingV2::TargetGroup
    Properties:
      Name: !Sub '${pSystem}-${pApp}-${pEnvironment}-public-tg'
      HealthCheckEnabled: true
      HealthCheckIntervalSeconds: 60
      HealthCheckPath: 'REDACTED'
      HealthCheckPort: 1234
      HealthCheckProtocol: HTTP
      HealthCheckTimeoutSeconds: 10
      HealthyThresholdCount: 2
      Matcher: 
        HttpCode: 200-299
      Port: 1234
      Protocol: HTTP
      ProtocolVersion: HTTP1
      TargetGroupAttributes: 
        - Key: 'deregistration_delay.timeout_seconds'
          Value: 300
        - Key: 'stickiness.enabled'
          Value: false
        - Key: 'load_balancing.algorithm.type'
          Value: round_robin
        - Key: 'slow_start.duration_seconds'
          Value: 0
      TargetType: instance
      UnhealthyThresholdCount: 2
      VpcId: !Ref pVpcId
      Targets: 
        - Id: !ImportValue 
          Fn::Sub: '${pSystem}-${pApp}-01-${pEnvironment}-ec2-id'
        - Id: !ImportValue
          Fn::Sub: "${pSystem}-${pApp}-02-${pEnvironment}-ec2-id"
        - Id: !ImportValue
          Fn::Sub: "${pSystem}-${pApp}-03-${pEnvironment}-ec2-id"

However, I receive this error in Cloudformation when it attempts to deploy:

No export named found

Which I have verified that all of my expected exports match this naming convention and are present in their respective stacks.

Reviewing the Template in Cloudformation, the template is translated to:

AWSTemplateFormatVersion: "2010-09-09"
Description: Creates an application load balancer.
Parameters:
  pSystem:
    Type: String
    Default: your-system-name
    Description: 'Name of the system. Default: your-system-name'
  pApp:
    Type: String
    Description: 'Name of the application solution'
  pEnvironment:
    Type: String
    Default: sbx
    Description: 'Name of the deployment tier. Default: sbx'
  pVpcId:
    Type: AWS::SSM::Parameter::Value<String>

Resources:

  rLoadBalancerTargetGroup:
    Type: AWS::ElasticLoadBalancingV2::TargetGroup
    Properties:
      Name:
        Fn::Sub: ${pSystem}-${pApp}-${pEnvironment}-public-tg
      HealthCheckEnabled: true
      HealthCheckIntervalSeconds: 60
      HealthCheckPath: /rest/web/system-healthy
      HealthCheckPort: 30600
      HealthCheckProtocol: HTTP
      HealthCheckTimeoutSeconds: 10
      HealthyThresholdCount: 2
      Matcher:
        HttpCode: 200-299
      Port: 30600
      Protocol: HTTP
      ProtocolVersion: HTTP1
      TargetGroupAttributes:
      - Key: deregistration_delay.timeout_seconds
        Value: 300
      - Key: stickiness.enabled
        Value: false
      - Key: load_balancing.algorithm.type
        Value: round_robin
      - Key: slow_start.duration_seconds
        Value: 0
      TargetType: instance
      UnhealthyThresholdCount: 2
      VpcId:
        Ref: pVpcId
      Targets:
      - Id:
          Fn::ImportValue: ''
        Fn::Sub: ${pSystem}-${pApp}-01-${pEnvironment}-ec2-id
      - Id:
          Fn::ImportValue: ''
        Fn::Sub: ${pSystem}-${pApp}-02-${pEnvironment}-ec2-id
      - Id:
          Fn::ImportValue: ''
        Fn::Sub: ${pSystem}-${pApp}-03-${pEnvironment}-ec2-id

Which has an empty string (”) after the Fn::ImportValue, and doesn’t appear to be reading the Sub command.

Any suggestions on how to import the EC2 instance ID’s for the target group?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật