# Terraform: configure API grants for machine-to-machine client

**URL:** <https://community.auth0.com/t/terraform-configure-api-grants-for-machine-to-machine-client/83215>\
**Category:** Get Help\
**Tags:** terraform\
**Created:** [May 11, 2022, 12:11am UTC](https://community.auth0.com/t/terraform-configure-api-grants-for-machine-to-machine-client/83215 "2022-05-11T00:11:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![georg.ikegps](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/georg.ikegps/32/36357_2.png) [@georg.ikegps](https://community.auth0.com/u/georg.ikegps)\
**Post date:** [May 11, 2022, 12:11am UTC](https://community.auth0.com/t/terraform-configure-api-grants-for-machine-to-machine-client/83215/1 "2022-05-11T00:11:23Z")

</div>

I would like to configure a machine-to-machine client via terraform.  
I can create the client but am unclear on how to connect it to an API - especially the [//us.auth0.com/api/v2///](https://us.auth0.com/api/v2///) api and configure the grants.

Is this possible, can you please provide an example or some hints on how to approach it?

I’m using the auth0/auth0 terraform provider.

Thank you!

---

<div class="post-metadata">

**Author:** ![georg.ikegps](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/georg.ikegps/32/36357_2.png) [@georg.ikegps](https://community.auth0.com/u/georg.ikegps)\
**Post date:** [May 11, 2022, 2:33am UTC](https://community.auth0.com/t/terraform-configure-api-grants-for-machine-to-machine-client/83215/2 "2022-05-11T02:33:54Z")

</div>

I think I worked it out.  
I was a bit confused to what the audience refers to.

```auto
resource "auth0_client" "user_management" {
  name = var.client_name
  description = var.client_description
  app_type = "non_interactive"
}

resource "auth0_client_grant" "user_management_grant" {
  audience = var.grant_audience
  client_id = auth0_client.ike_office_user_management.client_id
  scope = var.grant_scope
}

```

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [May 11, 2022, 11:09am UTC](https://community.auth0.com/t/terraform-configure-api-grants-for-machine-to-machine-client/83215/3 "2022-05-11T11:09:13Z")

</div>

Perfect! Thanks for sharing it with the rest of community!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [July 28, 2022, 1:11pm UTC](https://community.auth0.com/t/terraform-configure-api-grants-for-machine-to-machine-client/83215/4 "2022-07-28T13:11:18Z")

</div>


