hmar
hmar

Reputation: 117

Modify existing resource in Cloudformation

I have the next issue:

I have one cloudformation stack and i creating an Listener Rule and a target group and i need in the same CF attach this listener with this target group to an existing LB. (Created independently of this CF stack) I imported by Parameter the ARN of these LB, but its posible use this ARN to attach the listener rule?

If you need further info, tell me please. Thanks in advance.

Upvotes: 0

Views: 975

Answers (1)

lexicore
lexicore

Reputation: 43661

Yes, it is. Simply use ListenerArn. Here's an example:

  VideoclipUploadsHttpListenerRule:
    Type: AWS::ElasticLoadBalancingV2::ListenerRule
    Properties:
      Priority: 1
      ListenerArn: !ImportValue
        'Fn::Sub': 'stk-${EnvType}-${EnvId}-LoadBalancerHttpListenerArn'
      Actions:
        - Type: forward
          TargetGroupArn: !Ref VideoclipUploadsTargetGroup
      Conditions:
        - Field: 'path-pattern'
          PathPatternConfig:
            Values:
              - '/videoclip-uploads/*'

See AWS::ElasticLoadBalancingV2::ListenerRule.

Upvotes: 2

Related Questions