# Terraform - data source config json examples

**URL:** <https://community.squaredup.com/t/terraform-data-source-config-json-examples/2441>\
**Category:** SquaredUp Cloud\
**Tags:** terraform\
**Created:** [August 10, 2025, 8:42pm UTC](https://community.squaredup.com/t/terraform-data-source-config-json-examples/2441 "2025-08-10T20:42:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zafar.raza](https://community.squaredup.com/letter_avatar_proxy/v4/letter/z/f07891/32.png) [@zafar.raza](https://community.squaredup.com/u/zafar.raza)\
**Post date:** [August 10, 2025, 8:42pm UTC](https://community.squaredup.com/t/terraform-data-source-config-json-examples/2441/1 "2025-08-10T20:42:26Z")

</div>

Hi Team,

Does anyone have experience/examples of the json for each data source?  
The data source creates, but is missing the config e.g. ClientId

e.g.

resource “squaredup\_datasource” “m365” {  
display\_name = var.m365\_data\_source\_name  
data\_source\_name = var.m365\_data\_source\_name

**config = jsonencode({**  
\*\* azureTenantId = var.azuretenantid\*\*  
\*\* azureClientId = var.azureclientid\*\*  
\*\* azureClientSecret = data.azurerm\_key\_vault\_secret.azure\_client\_secret.value\*\*  
})  
}

---

<div class="post-metadata">

**Author:** ![IronMode](https://community.squaredup.com/letter_avatar_proxy/v4/letter/i/e9bcb4/32.png) [@IronMode](https://community.squaredup.com/u/IronMode)\
**Post date:** [August 12, 2025, 11:29am UTC](https://community.squaredup.com/t/terraform-data-source-config-json-examples/2441/2 "2025-08-12T11:29:43Z")

</div>

Hi,  
If you’re configuring Microsoft Office 365, you can use the following:

```auto
resource "squaredup_datasource" "prod_o365" {
  display_name = "Production Microsoft 365"
  data_source_name = "Microsoft 365"
  config = jsonencode({
    intune = "intune" // Adds Intune support
    authType = "clientCreds"
    intuneImportUsers = true // Imports user objects to the graph
    tenantId = var.tenant_id
    clientId = var.prod_o365_read_only_client_id
    clientSecret = var.prod_o365_read_only_client_secret
  })
}

```

---

<div class="post-metadata">

**Author:** ![zafar.raza](https://community.squaredup.com/letter_avatar_proxy/v4/letter/z/f07891/32.png) [@zafar.raza](https://community.squaredup.com/u/zafar.raza)\
**Post date:** [August 12, 2025, 7:53pm UTC](https://community.squaredup.com/t/terraform-data-source-config-json-examples/2441/3 "2025-08-12T19:53:19Z")

</div>

You don’t happen to have an example for Web API?

What I have so far…

resource “squaredup\_datasource” “azure\_api” {  
display\_name = “Azure API”  
data\_source\_name = “Web API”

config = jsonencode({  
baseUrl = var.api\_base\_url  
authentication = {  
type = “oauth2-client-credentials”  
sendCredentialsIn = “body”  
tokenUrl = var.api\_token\_url  
clientId = var.azureclientid  
clientSecret = data.azurerm\_key\_vault\_secret.azure\_client\_secret.value  
scope = var.api\_authorization\_scope  
}  
})

---

<div class="post-metadata">

**Author:** ![clarkd](https://community.squaredup.com/user_avatar/community.squaredup.com/clarkd/32/764_2.png) [@clarkd](https://community.squaredup.com/u/clarkd)\
**Post date:** [August 13, 2025, 11:06am UTC](https://community.squaredup.com/t/terraform-data-source-config-json-examples/2441/4 "2025-08-13T11:06:28Z")

</div>

Hi Zafar,

Dave Clarke - one of the PMs at SquaredUp here. I’ve raised a feature request to allow you to easily copy the data source config via the UI easily - that should at least give you a template to start working from! That will be released in the next couple of days.

In the meantime, here’s an example Web API config that might get you going:

```auto
jsonencode({
  baseUrl = "https://swapi.py4e.com/api/"
  authMode = "none"
  ignoreCertificateErrors = false
  queryArgs = [
    {
      key = "queryParameter"
      value = "123"
    }
  ]
  headers = [
    {
      key = "header"
      value = "abc"
    }
  ]
})

```

I hope that helps!

---

<div class="post-metadata">

**Author:** ![clarkd](https://community.squaredup.com/user_avatar/community.squaredup.com/clarkd/32/764_2.png) [@clarkd](https://community.squaredup.com/u/clarkd)\
**Post date:** [August 15, 2025, 12:46pm UTC](https://community.squaredup.com/t/terraform-data-source-config-json-examples/2441/5 "2025-08-15T12:46:56Z")

</div>

@zafar.raza It’s now possible to copy the (JSON) config of a data source with just a click. When creating, or editing an existing, data source select […] → Copy JSON configuration to copy the current configuration. Give it a try and let me know if it helps!

 ![image](https://community-cdn.squaredup.com/original/2X/7/7ef40a4558a3abe7a1bf6a9cd63cbe0785bfbf24.png)
