Skip to content

[Bug] Google .gemini connector not recognized as valid connector id in elasticstack_kibana_action_connector #727

@phandox

Description

@phandox

Describe the bug
Terraform can't spin up Gemini Connector for Elastic AI Assistant using elasticstack_kibana_action_connector resource.

To Reproduce
Steps to reproduce the behavior:
Assume that elastic connection is already set up and working

  1. dummy terraform config
resource "google_service_account" "gemini_sa" {
  account_id = "ec-observability-ai-assist"
  project = "<redacted>"
}

resource "google_service_account_key" "observability_gemini" {
  service_account_id = google_service_account.gemini_sa.id
}

resource "google_project_iam_member" "observability_gemini" {
  member  = google_service_account.gemini_sa.member
  project = "<redacted>"
  role    = "roles/aiplatform.user"
}

resource "elasticstack_kibana_action_connector" "observability_gemini_connector" {
  provider = elasticstack.observability
  connector_type_id = ".gemini"
  name              = "gemini-playground"
  config = jsonencode({
    apiUrl = "https://europe-west3-aiplatform.googleapis.com"
    defaultModel = "gemini-1.5-pro-001"
    gcpProjectID = "<redacted>"
    gcpRegion = "europe-west3"
  })
  secrets = base64decode(google_service_account_key.gemini_sa.private_key)
}
  1. terraform apply fails with
  # elasticstack_kibana_action_connector.observability_gemini_connector will be created
  + resource "elasticstack_kibana_action_connector" "observability_gemini_connector" {
      + config             = jsonencode(
            {
              + apiUrl       = "https://europe-west3-aiplatform.googleapis.com"
              + defaultModel = "gemini-1.5-pro-001"
              + gcpProjectID = "<redacted>"
              + gcpRegion    = "europe-west3"
            }
        )
      + connector_id       = (known after apply)
      + connector_type_id  = ".gemini"
      + id                 = (known after apply)
      + is_deprecated      = (known after apply)
      + is_missing_secrets = (known after apply)
      + is_preconfigured   = (known after apply)
      + name               = "gemini-playground"
      + secrets            = (sensitive value)
      + space_id           = "default"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

elasticstack_kibana_action_connector.observability_gemini_connector: Creating...
╷
│ Error: unknown connector type [.gemini]
│ 
│   with elasticstack_kibana_action_connector.observability_gemini_connector,
│   on observability_elastic_ai_assistant.tf line 18, in resource "elasticstack_kibana_action_connector" "observability_gemini_connector":
│   18: resource "elasticstack_kibana_action_connector" "observability_gemini_connector" {
│ 
╵

Expected behavior
I would expect the connector to be created. I was able to make it work when I created it from UI

When I created connected in UI, I exported it as saved object and matched the config to Terraform. Thats how I find the .gemini as connector_type_id.

{
  "attributes": {
    "actionTypeId": ".gemini",
    "config": {
      "apiUrl": "https://europe-west3-aiplatform.googleapis.com",
      "defaultModel": "gemini-1.5-pro-001",
      "gcpProjectID": "<redacted>",
      "gcpRegion": "europe-west3"
    },
    "isMissingSecrets": true,
    "name": "gemini-playground",
    "secrets": {}
  },
  "coreMigrationVersion": "8.8.0",
  "created_at": "2024-08-23T08:22:53.546Z",
  "id": "dddd16c7-859e-49cf-903f-9305f82c660b",
  "managed": false,
  "references": [],
  "sort": [
    1724401373546,
    4294967344
  ],
  "type": "action",
  "typeMigrationVersion": "10.1.0",
  "updated_at": "2024-08-23T08:22:53.546Z",
  "version": "WzIwOTAwOTUsNDdd"
}

Versions (please complete the following information):

  • OS: Linux
  • Terraform Version: 1.5.7
  • Provider version: 0.11.6
  • Elasticsearch Version: 8.15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions