I am trying to extract out the arn of an AWS LB. One of the tags for this ALB is as follows
elbv2.k8.aws/cluster = “my-shiny-eks-cluster” and ideally also narrow it down by the vpc-id too, but if I can live with just using elbv2.k8.aws/cluster tag to get the arn.
When I tried to do the following, I am not getting anywhere. I tried using the “filter” command but no luck there either. I did read somewhere that the “filter” command is not available for all data resources. What are my options here?
I am sorry I should have mentioned the error message. Please note the forums are blocked at work, so I am typing up the alerts, excuse any typos here, I don’t have any typos in my code.
I am running terraform 1.3.1
When I change the data source block with the exact “name” or the “arn” of the ALB, I get the results. I just don’t know what I am doing wrong when I compose the tags map especially when it has characters like “.” & “/” in it. I have tried the standard linux \ options, but no luck.
Also please note there are 2 other tags AWS populates, so the following 3 tags are present in this ALB(Application Load Balancer)
Error: Argument or block definition is required.
on main.tf line 33, in data "aws_lb" "alb_listener_details"
33: elbv2.k8s.aws/cluster = "my-shiny-eks-cluster"
"An argument or block definition is required here. To set an argument, use the equals sign "=" to introduce the argument value.
Looking at what you shared, I expect you would also have needed to put that tag name in quotes, because the dots and slashes mean it isn’t a valid identifier in the HCL language. So presumably your final configuration looks something like this:
(I’m posting this mainly because questions here tend to otherwise attract “I have the same problem! How did you solve it?” comments months later, so I’m trying to pre-empt that by sharing a working example! )