elastic / terraform-provider-elasticstack

Terraform provider for Elastic Stack
https://registry.terraform.io/providers/elastic/elasticstack/latest/docs
Apache License 2.0
167 stars 89 forks source link

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

Open phandox opened 1 month ago

phandox commented 1 month ago

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 = "" 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 = "" gcpRegion = "europe-west3" }) secrets = base64decode(google_service_account_key.gemini_sa.private_key) }

2. `terraform apply` fails with

elasticstack_kibana_action_connector.observability_gemini_connector will be created

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": "", "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
ebeahan commented 4 days ago

I'm encountering the same issue with AWS Bedrock:

Error: unknown connector type [.bedrock]