wallix / awless

A Mighty CLI for AWS
http://awless.io/
Apache License 2.0
4.97k stars 263 forks source link

awless list listeners does not include target groups #189

Closed moshloop closed 6 years ago

simcap commented 6 years ago

@moshloop The listing of the listener will not include its targetgroups. It seems the AWS API sees listeners as an intermediary components sitting between loadbalancers and targetgroups and that there is no obvious API call to link the two directly.

But using the awless show command, you can have the full tree of relations for the 3 components starting from the load balancer. Run:

awless show name_of_my_loadb

(note: you can add the local flag -l allowing offline exploration of resources using the local storage previoulsy synced.)

In the lineage section, you will see the listeners attached to this loadb. In the applied on, section you will see the targetgroups it applies on.

moshloop commented 6 years ago

I am ultimately trying to get the target group ARN from a loadbalancer but I don't see a way of doing that  - the tree might display it, but I can't get just the ARN The AWS cli does return it: aws elbv2 describe-listeners --load-balancer-arn {    "Listeners": [        {            "ListenerArn": "arn:aws:elasticloadbalancing:eu-central-1:xxxb5adde7",             "LoadBalancerArn": "arn:aws:elasticloadbalancing:eu-central-1:xxxx2a",            "Port": 80,             "Protocol": "HTTP",            "DefaultActions": [                {                     "Type": "forward",                    "TargetGroupArn": "arn:aws:elasticloadbalancing:eu-central-1:xxxf8b02"                }             ]        },        {            "ListenerArn": "arn:aws:elasticloadbalancing:eu-central-1:x59810",             "LoadBalancerArn": "arn:aws:elasticloadbalancing:eu-central-1:3xa",             "Port": 443,            "Protocol": "HTTPS",             "Certificates": [                {                     "CertificateArn": "arn:aws:acm:eu-central-1:xfc8c"                 }            ],            "SslPolicy": "ELBSecurityPolicy-2016-08",            "DefaultActions": [                {                     "Type": "forward",              "TargetGroupArn": "arn:aws:elasticloadbalancing:eu-central-1:xxxx:targetgroup/xxxxx/xxxxx"                 }            ]        }    ]}

On Thu, Feb 1, 2018 3:22 PM, Simon Caplette notifications@github.com wrote: @moshloop The listing of the listener will not include its targetgroups. It seems the AWS API sees listeners as an intermediary components sitting between loadbalancers and targetgroups and that there is no obvious API call to link the two directly.

But using the awless show command, you can have the full tree of relations for the 3 components starting from the load balancer. Run:

awless show name_of_my_loadb

(note: you can add the local flag -l allowing offline exploration of resources using the local storage previoulsy synced.)

In the lineage section, you will see the listeners attached to this loadb. In the applied on, section you will see the targetgroups it applies on.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

simcap commented 6 years ago

I will see how if I can implement a way to get this information in the listing and mimic what the aws-cli does.

In the meantime (and a bit more cumbersome) to get the targetgroup ARN from a loadbalancer you can do:

  1. awless show my-loadbalancer-name
  2. Look at the section Applied on and grab the name of any targetgroup you want in there.
  3. Then with the name from above do awless show my-target-group-name -l
simcap commented 6 years ago

@moshloop Fixed on master.

I have added the TargetGroups column in the listing of listeners. I display the short ARN for this column since there could be multiple TargetGroups for a listener.

Let me know is that is ok and fixes the issue for you. Thanks.

moshloop commented 6 years ago

@simcap awesome - thanks, will test and let you know if their are any issues