Hi everyone! Could you help me? I’m a little confused.
Is there a way to use the context of data template_file resource without EOT tags?
So I have created Nginx Ingress in EKS from .yaml file. In turn, a load balancer appeared, but the terraform state knows nothing about it. And I created null_resource which getting the NLB description and sends the NLB ARN to file.
null_resource
resource “null_resource” “load_balancer_arn” {
provisioner “local-exec” {
command = “aws elbv2 describe-load-balancers | jq -r ‘.LoadBalancers.LoadBalancerArn’ > nlb_arn.tpl”
}
}
Then I created the data template_file where I set nlb_arn.tpl, created in the null_resource.
Data template_file
data “template_file” “nlb_arn” {
template = “${file(“templates/nlb_arn.tpl”)}”
}
And when I try to use this context in another resource I get the error about invalid format.
Resource with ARN
resource “aws_api_gateway_vpc_link” “vpc_link” {
name = var.vpc_link_name
target_arns = [data.template_file.nlb_arn.template]
}
When I use this case I get output like:
EOT
arn:1111111:111111111:11111111
EOT
So how to remove EOT tags and use only sting with arn?
(terraform output -json nlb_arn - provides necessary value without EOT, but no way to use it in the resource)
Thanks!