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 = []
}
Solution
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:
<rousource_provider>.<resource_name>.<TheRequiredAttribute>
In this case, it would be something similar to this:
auth0_client.my_client.client_id
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 | HashiCorp Developer
Modules: Modules - Configuration Language | Terraform | HashiCorp Developer