elastic / elastic/terraform-provider-elasticstack

[Bug] Error: Unable to create apikey without an elasticsearch_connection

Open
#628 2 comments 0 reactions 0 assignees View on GitHub
bug needs-reproduction triaged
Dominant language
Go
Stars
209
Forks
150
Avg merge
22h 33m
Merged PRs (30d)
176

Description

**Describe the bug**
I am using version "3.97.1" of `azurerm`, where the `elasticsearch_connection` is getting deprecated. When trying to create the `elasticstack_elasticsearch_security_api_key` without the `elasticsearch_connection`, I am getting this error:

```
│ Error: Unable to create apikey

│ Failed with:
│ {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"creating
│ derived api keys requires an explicit role descriptor that is empty (has no
│ privileges)"}],"type":"illegal_argument_exception","reason":"creating
│ derived api keys requires an explicit role descriptor that is empty (has no
│ privileges)"},"status":400}

```
But I did add the empty role descriptor, as can be seen in this terraform plan:
```
resource "***stack_***search_security_api_key" "api_key_test" {
+ api_key = (sensitive value)
+ encoded = (sensitive value)
+ expiration_timestamp = (known after apply)
+ id = (known after apply)
+ metadata = (known after apply)
+ name = "test1"
+ role_descriptors = jsonencode({})
}
```

Moreover, I would love to see an example of how to assign an user to the api_key without using the `elasticsearch_connection`, since I have not found clear examples in the documentation.

**To Reproduce**
Steps to reproduce the behavior:
1. TF configuration used 'azurerm v3.97.1'
2. Resource:
```
resource "elasticstack_elasticsearch_security_api_key" "api_key_test" {
name = "test1"
role_descriptors = jsonencode({})
}
```
3. Failed on `terraform apply`

**Expected behavior**
The new api key is created in elasticsearch.

**Versions (please complete the following information):**
- OS: Ubuntu 2204
- Terraform Version 1.3.9
- Provider version 3.97.1
- Elasticsearch Version 8.5.1

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.