Hi all! I'm having some trouble using the yq `join...
# atmos
r
Hi all! I'm having some trouble using the yq
join
function in atmos. I am creating a Kubernetes ingress and want an annotation like
alb.ingress.kubernetes.io/subnets: subnet1, subnet2, subnet3
using the Terraform output function. I'm trying something like:
alb.ingress.kubernetes.io/subnets: !terraform.output vpc plat-ue1-prod ".public_subnet_ids[] | join("","")"
but haven't gotten it to work. I've also tried something like
'.public_subnet_ids[] | join(",")'
but that doesn't work either. Has anyone here successfully joined an array through the
!terraform.output
function? Let me know if you want more info
✅ 1
a
try this
Copy code
'.public_subnet_ids | join(",")'
(w/o
[]
)
r
Thanks Andriy, unfortunately that gave this error
parse error on line 1, column 46: bare " in non-quoted-field
a
what Atmos version are you using?
the single quotes around YQ expressions were fixed in the last release
r
Ah, this worked:
".public_subnet_ids | join("", "")"
🚀 1
I was using 1.189.0
a
so in the latest release, this should work as well
Copy code
'.public_subnet_ids | join(",")'
👍 1
r
Thanks! When I can I'll try that (with the latest version) and post a followup here
a
if you are using S3 backend, switch to https://atmos.tools/functions/yaml/terraform.state instead of
!terraform.output
, it's 10x faster
🙌 1