Terraform - Passing Output of Other resources During Execution

Problem Statement

We need to create a client grant with information obtained during the same deployment, in this case, the client_id of a client application created on the same run. How to do it?

resource "auth0_client_grant" "my_client_grant" {
client_id = "<client_id>"
audience = "<audience>"
scope = []


When provisioning the a resource, they can call its output values during execution. For instance, for resource

"auth0_client" "my_client" {
//your code for this client

you can call a specific value obtained during execution in the following way:


In this case, it would be something similar to this:


Additionally, we suggest you look at both Terraform Outputs and Terraform Modules so their terraform implementation could be easy to maintain and reuse in the future.

Outputs: Output Values - Configuration Language | Terraform by HashiCorp
Modules: Modules - Configuration Language | Terraform by HashiCorp