<p>I want to deploy metallb using terraform. metallb configuration is as follows.</p>

<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    address-pools:
    - name: default
      protocol: layer2
      addresses:
      - 172.16.99.1-172.16.99.255
</code></pre>

<p>Is it possible deploy such --from-file configuration using kubernetes_config_map resource?</p>

<p>You can use the <a href="https://www.terraform.io/docs/configuration/interpolation.html#file-path-" rel="nofollow noreferrer">file() interpolation function</a> to read the file contents.  That might look like:</p>

<pre><code>resource "kubernetes_config_map" "config" {
  metadata {
    namespace = "metallb_system"
    name = "config"
  }
  data {
    config = "${file(${path.module}/config.yml)}"
  }
}
</code></pre>

<p>Unlike <code>kubectl create configmap --from-file</code> you do have to specify the filename twice.</p>
