<p>I need to get an ALB name or id to attach WAF rules to it.
The ALB is created by Kubernetes and not used anywhere in Terraform.
Oficial data resource only supports name and arn with no filtering.</p>
<pre><code>data &quot;aws_lb&quot; &quot;test&quot; {
  name = ...
  arn = ...
}
</code></pre>
<p>Is there a way to get ALB somehow or attach WAF rules to it?</p>

Adam
<p>I'm currently facing the same issue, the name of the ALB doesn't appear to be something that you can set whilst you're deploying the Helm chart and there doesn't appear to be a way of getting the name once the chart has been deployed.</p>
<p>The only workaround I can think of is to describe the ingress resource and then do a trim of some sort on the ingress address using Terraform (ignoring everything after the 4th dash).</p>
<p>It's not a great workaround but is the only one that I've come up with to get this all working through Terraform. Do let me know if you find a better solution for this.</p>
<p>EDIT: It appears that there is already an open issue for this on GitHub: <a href="https://github.com/hashicorp/terraform-provider-aws/issues/12265" rel="nofollow noreferrer">https://github.com/hashicorp/terraform-provider-aws/issues/12265</a> There is a solution posted a bit further down in the thread which is similar to what I had originally suggested - using regex to get the name of the load balancer from the ingress resource.</p>
