Skip to content

[Bug] Defend for Containers - The terraform-provider-elasticstack_v0.11.9 plugin crashed #907

Closed
@doom160

Description

@doom160

Describe the bug
I am trying to create defend for container integration with default settings and it is throwing these errors.
I went to the UI, the integration was created successfully.
doesnt look like i have passed the wrong variables?

To Reproduce
Steps to reproduce the behavior:

  1. terraform apply
  2. See the error in the output '...'

Expected behavior

resource "elasticstack_fleet_integration" "defend" {
  name    = "cloud_defend"
  version = "1.2.6"
  force   = true
  skip_destroy = true
}

resource "elasticstack_fleet_integration_policy" "defend" {
  name                = "test"
  namespace           = "default"
  description         = "test"
  enabled             = true
  agent_policy_id     = var.agent_policy_id
  integration_name    = elasticstack_fleet_integration.defend.name
  integration_version = elasticstack_fleet_integration.defend.version

  input {
    input_id = "cloud_defend-cloud_defend/control"
    enabled  = true
    vars_json = jsonencode({"configuration": var.integration_yaml})
    streams_json = jsonencode({
        "cloud_defend.alerts": {
         "enabled": true
        },
        "cloud_defend.file": {
          "enabled": true
        },
        "cloud_defend.heartbeat": {
          "enabled":  true,
          "vars": {
            "period": "30m"
          }
        },
        "cloud_defend.metrics": {
          "enabled": true,
          "vars": {
            "period": "24h"
          }
        },
        "cloud_defend.process": {
          "enabled": true
        }
      })
  }
}

variable "integration_yaml"{
    default = <<EOF
process:
  selectors:
    - name: allProcesses
      operation: [fork, exec]
  responses:
    - match: [allProcesses]
      actions: [log]
file:
  selectors:
    - name: executableChanges
      operation: [createExecutable, modifyExecutable]
  responses:
    - match: [executableChanges]
      actions: [alert]
EOF
    type = string
    description = "Defend for Elastic YAML Configuration"
}

Debug output
Run terraform command with TF_LOG=trace and provide extended information on TF operations. Please ensure you redact any base64 encoded credentials from your output.
eg

╷
│ Error: Plugin did not respond
│ 
│ The plugin encountered an error, and failed to respond to the plugin6.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain
│ more details.
╵
Stack trace from the terraform-provider-elasticstack_v0.11.9 plugin:

panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 177 [running]:
github.com/elastic/terraform-provider-elasticstack/internal/fleet/integration_policy.HandleRespSecrets({0x5062058, 0xc000825950}, 0xc000372070, {0x505d1e8, 0xc0001ec030})
        github.com/elastic/terraform-provider-elasticstack/internal/fleet/integration_policy/secrets.go:108 +0x306
github.com/elastic/terraform-provider-elasticstack/internal/fleet/integration_policy.(*integrationPolicyResource).Read(0xc0001ec008, {0x5062058, 0xc000825950}, {{{{0x50688f8, 0xc000811b30}, {0x4e57bc0, 0xc000811770}}, {0x506b960, 0xc0008260f0}}, 0xc0001ec030, ...}, ...)
        github.com/elastic/terraform-provider-elasticstack/internal/fleet/integration_policy/read.go:37 +0x2b9
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).ReadResource(0xc00026e1e0, {0x5062058, 0xc000825950}, 0xc0008259b0, 0xc000053590)
        github.com/hashicorp/[email protected]/internal/fwserver/server_readresource.go:117 +0x84e
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).ReadResource(0xc00026e1e0, {0x5062058?, 0xc000825860?}, 0xc000516480)
        github.com/hashicorp/[email protected]/internal/proto6server/server_readresource.go:55 +0x38e
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ReadResource(0xc000372460, {0x5062058?, 0xc000825590?}, 0xc000516480)
        github.com/hashicorp/[email protected]/tf6muxserver/mux_server_ReadResource.go:35 +0x193
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ReadResource(0xc000366780, {0x5062058?, 0xc0008241b0?}, 0xc00021e070)
        github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:784 +0x2f3
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ReadResource_Handler({0x4ffefa0, 0xc000366780}, {0x5062058, 0xc0008241b0}, 0xc00079a000, 0x0)
        github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:509 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00019d200, {0x5062058, 0xc000824120}, {0x5069fa0, 0xc00035b6c0}, 0xc00089cc60, 0xc000426480, 0x5d153e8, 0x0)
        google.golang.org/[email protected]/server.go:1394 +0xe2b
google.golang.org/grpc.(*Server).handleStream(0xc00019d200, {0x5069fa0, 0xc00035b6c0}, 0xc00089cc60)
        google.golang.org/[email protected]/server.go:1805 +0xe8b
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/[email protected]/server.go:1029 +0x7f
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 17
        google.golang.org/[email protected]/server.go:1040 +0x125

Error: The terraform-provider-elasticstack_v0.11.9 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions (please complete the following information):

  • OS: - mac
  • Terraform Version v1.6.4
  • Provider version 0.11.9
  • Elasticsearch Version 8.12.2

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions