# Error in building k8 objects when using terraform to create filebeat as a resource

**URL:** https://discuss.elastic.co/t/error-in-building-k8-objects-when-using-terraform-to-create-filebeat-as-a-resource/301145
**Category:** Beats
**Tags:** filebeat
**Created:** [March 30, 2022, 9:19pm UTC](https://discuss.elastic.co/t/error-in-building-k8-objects-when-using-terraform-to-create-filebeat-as-a-resource/301145 "2022-03-30T21:19:47Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![surprised\_ferret](https://avatars.discourse-cdn.com/v4/letter/s/dbc845/32.png) [@surprised\_ferret](https://discuss.elastic.co/u/surprised_ferret)
#### Post date: [March 30, 2022, 9:19pm UTC](https://discuss.elastic.co/t/error-in-building-k8-objects-when-using-terraform-to-create-filebeat-as-a-resource/301145/1 "2022-03-30T21:19:47Z")

</div>

I am trying to do something similar to this post over at Hashicorp: [Terraform and helm\_release - #7 by stuart-c](https://discuss.hashicorp.com/t/terraform-and-helm-release/21478/7) - Essentially, installing filebeat on a kubernetes cluster inside AKS.

Here’s my filebeat config file (filebeat.yaml)

```auto
filebeatConfig:
  filebeat.yml: |
    filebeat.inputs:
      - type: log
        paths:
          - /usr/share/filebeat/logs/filebeat
    output.elasticsearch:
      hosts: '["my_host_url"]'
      api_key: "${EC_API_KEY}"

```

and referencing it in my filebeat.tf as below

```auto
resource "helm_release" "filebeat" {
  name = "filebeat"
  repository = "https://helm.elastic.co"
  chart = "filebeat"
  version = "7.9.3"
  namespace = "kube-system"

  values = [templatefile("${path.module}/filebeat.yaml", 
  {
    EC_API_KEY = var.EC_API_KEY
  })]

  depends_on = [
    ec_deployment.global
  ]

}

```

when I run `terraform apply` , I get this error:

```auto
helm_release.filebeat: Creating...
╷
│ Error: unable to build kubernetes objects from release manifest: [unable to recognize "": no matches for kind "ClusterRole" in version "rbac.authorization.k8s.io/v1beta1", unable to recognize "": no matches for kind "ClusterRoleBinding" in version "rbac.authorization.k8s.io/v1beta1"]
│ 
│ with helm_release.filebeat,
│ on filebeat.tf line 1, in resource "helm_release" "filebeat":
│ 1: resource "helm_release" "filebeat" {
│ 
╵

```

I’m not sure where to go from here. I also think I should be referencing the aks cluster info somewhere in my filebeats.tf, but not sure where.

Any tips would be appreciated. Thank you

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [April 27, 2022, 11:20pm UTC](https://discuss.elastic.co/t/error-in-building-k8-objects-when-using-terraform-to-create-filebeat-as-a-resource/301145/2 "2022-04-27T23:20:31Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
