<p>I am trying to set an environment variable for my Helm Chart deployment via terraform.  Currently my code looks like:</p>
<pre><code>resource &quot;helm_release&quot; &quot;datadog&quot; {
  name       = &quot;datadog&quot;
  repository = &quot;https://helm.datadoghq.com&quot;
  chart      = &quot;datadog&quot;

  namespace        = &quot;datadog&quot;
  create_namespace = true

  # Default Configuration items
  set {
    name  = &quot;datadog.apiKey&quot;
    value = var.datadog_api_key
  }

  set {
    name  = &quot;datadog.appKey&quot;
    value = var.datadog_app_key
  }

  set {
    name  = &quot;clusterAgent.enabled&quot;
    value = true
  }

  set {
    name  = &quot;targetSystem&quot;
    value = &quot;linux&quot;
  }

  # Set Datadog Configuration Items

  # Event Collection
  set {
    name  = &quot;agents.rbac.create&quot;
    value = true
  }

  set {
    name  = &quot;datadog.leaderElection&quot;
    value = true
  }

  set {
    name  = &quot;datadog.collectEvents&quot;
    value = true
  }

  # Custom/External Metrics
  set {
    name  = &quot;clusterAgent.metricsProvider.enabled&quot;
    value = true
  }

  # APM Configuration
  set {
    name  = &quot;datadog.apm.enabled&quot;
    value = true
  }

  # Logs Configuration
  set {
    name  = &quot;datadog.logs.enabled&quot;
    value = true
  }

  set {
    name  = &quot;datadog.logs.containerCollectAll&quot;
    value = true
  }

  set {
    name  = &quot;datadog.containerExcludeLogs&quot;
    value = local.exclude_image_list
  }

  # Set logging verbosity, valid log levels are: trace, debug, info, warn, error, critical, off.  Default is info
  set {
    name  = &quot;datadog.logLevel&quot;
    value = &quot;INFO&quot;
  }

  # Process Collection Configuration
  set {
    name  = &quot;datadog.processAgent.enabled&quot;
    value = true
  }

  # Exclude Containers
  set {
    name  = &quot;datadog.containerExclude&quot;
    value = local.exclude_image_list
  }

  # Set Environment Variables
  # DD_LOGS_CONFIG_USE_HTTP is for DD AWS PrivateLink: https://docs.datadoghq.com/agent/guide/private-link/?tab=useast1
  set {
    name  = &quot;env&quot;
    value = &quot;{DD_LOGS_CONFIG_USE_HTTP = true}&quot;
  }
}
</code></pre>
<p>Notice at the bottom, how I am setting this.  I have tried passing this in as a string, which does not work.  I also have set this as a map which does not work either.  When I set it as a map, I get the following error:</p>
<pre><code>╷
│ Error: Incorrect attribute value type
│ 
│   on .terraform/modules/datadog/helm.tf line 104, in resource &quot;helm_release&quot; &quot;datadog&quot;:
│  104:     value = {&quot;DD_LOGS_CONFIG_USE_HTTP&quot; = true}
│ 
│ Inappropriate value for attribute &quot;value&quot;: string required.
</code></pre>
<p>This is the helm chart that I am trying to modify:</p>
<p><a href="https://github.com/DataDog/helm-charts/tree/main/charts/datadog" rel="nofollow noreferrer">https://github.com/DataDog/helm-charts/tree/main/charts/datadog</a></p>

sd-gallowaystorm
<p>Actually, the value of <a href="https://github.com/DataDog/helm-charts/blob/main/charts/datadog/values.yaml#L400" rel="nofollow noreferrer">env</a> should be an array of objects with the keys (<code>name</code>, <code>value</code>), terraform allows you to define a key in an array element, so you can do that in two steps:</p>
<ol>
<li>set the value for the key <code>name</code> for the first element</li>
<li>set the value for the key <code>value</code> for the first element</li>
</ol>
<pre><code>resource &quot;helm_release&quot; &quot;datadog&quot; {
  name       = &quot;datadog&quot;
  repository = &quot;https://helm.datadoghq.com&quot;
  chart      = &quot;datadog&quot;

  namespace        = &quot;datadog&quot;
  create_namespace = true

  # Default Configuration items
  set {
    name  = &quot;datadog.apiKey&quot;
    value = var.datadog_api_key
  }

  set {
    name  = &quot;datadog.appKey&quot;
    value = var.datadog_app_key
  }

  set {
    name  = &quot;clusterAgent.enabled&quot;
    value = true
  }

  set {
    name  = &quot;targetSystem&quot;
    value = &quot;linux&quot;
  }

  # Set Datadog Configuration Items

  # Event Collection
  set {
    name  = &quot;agents.rbac.create&quot;
    value = true
  }

  set {
    name  = &quot;datadog.leaderElection&quot;
    value = true
  }

  set {
    name  = &quot;datadog.collectEvents&quot;
    value = true
  }

  # Custom/External Metrics
  set {
    name  = &quot;clusterAgent.metricsProvider.enabled&quot;
    value = true
  }

  # APM Configuration
  set {
    name  = &quot;datadog.apm.enabled&quot;
    value = true
  }

  # Logs Configuration
  set {
    name  = &quot;datadog.logs.enabled&quot;
    value = true
  }

  set {
    name  = &quot;datadog.logs.containerCollectAll&quot;
    value = true
  }

  set {
    name  = &quot;datadog.containerExcludeLogs&quot;
    value = local.exclude_image_list
  }

  # Set logging verbosity, valid log levels are: trace, debug, info, warn, error, critical, off.  Default is info
  set {
    name  = &quot;datadog.logLevel&quot;
    value = &quot;INFO&quot;
  }

  # Process Collection Configuration
  set {
    name  = &quot;datadog.processAgent.enabled&quot;
    value = true
  }

  # Exclude Containers
  set {
    name  = &quot;datadog.containerExclude&quot;
    value = local.exclude_image_list
  }

  # Set Environment Variables
  # DD_LOGS_CONFIG_USE_HTTP is for DD AWS PrivateLink: https://docs.datadoghq.com/agent/guide/private-link/?tab=useast1
  set {
    name  = &quot;env[0].name&quot;
    value = &quot;DD_LOGS_CONFIG_USE_HTTP&quot;
  }
  set {
    name  = &quot;env[0].value&quot;
    value = &quot;true&quot;
  }
}
</code></pre>
