title: How can I access value of tuple?
body: <p>I would like to know how can I access the value from the following output:</p>
  <pre><code>output &quot;backend_tg_arn&quot; {
    value = var.backend_tg_needed ? aws_lb_target_group.backend_tg[*].arn : null
  }
  </code></pre>
  <p>It is generated with the following code:</p>
  <pre><code>resource &quot;aws_lb_target_group&quot; &quot;backend_tg&quot; {
    count       = var.backend_tg_needed ? 1 : 0
    name        = &quot;${var.client_code}-${var.environment}-backend-tg&quot;
    port        = var.backend_port
    protocol    = &quot;HTTP&quot;
    target_type = var.backend_target_type
    vpc_id      = aws_vpc.main_vpc.id
  }
  </code></pre>
  <p>The output from above is passed to another module as variable:</p>
  <pre><code>   backend_tg_arn = module.network.backend_tg_arn
  </code></pre>
  <p>and I'm trying to assign it to default action for alb listener:</p>
  <pre><code>  default_action {
      type             = &quot;forward&quot;
      target_group_arn = var.backend_tg_arn
    }
  }
  </code></pre>
  <p>Getting error:</p>
  <blockquote>
  <p>var.backend_tg_arn is tuple with 1 element</p>
  <p>Inappropriate value for attribute &quot;target_group_arn&quot;: string required.</p>
  </blockquote>
  <p>I am struggling how can I access this <code>arn</code> value... it should be done with some kind of loop but can't figure it out.</p>