Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] elasticstack_elasticsearch_security_api_key expired keys #898

Open
mac2000 opened this issue Nov 4, 2024 · 0 comments
Open

[Bug] elasticstack_elasticsearch_security_api_key expired keys #898

mac2000 opened this issue Nov 4, 2024 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@mac2000
Copy link

mac2000 commented Nov 4, 2024

Describe the bug

Not sure if that's a bug or feature request

To Reproduce

imagine you have created an api key like so: (nothing special, bare minimal example) and wish to sync it to key vault

resource "elasticstack_elasticsearch_security_api_key" "example" {
  name             = "example"
  expiration       = "30d"
  role_descriptors = jsonencode({}) # not actually used, but triggers terraform to recreate api key, if not passed
  metadata         = jsonencode({})
}

resource "azurerm_key_vault_secret" "example" {
  name         = "example"
  value        = elasticstack_elasticsearch_security_api_key.example.encoded
  key_vault_id = data.azurerm_key_vault.example.id
}

Expected behavior

After month, I am expecting terraform to somehow notice that apikey is changed and sync it

but nothing happens, attempts to run terraform plan says "nothing changed" 🤔

and because of that, all other resources that rely on apikey stops working

Versions (please complete the following information):

  • OS: N/A
  • Terraform Version 1.9.8
  • Provider version 0.11.11
  • Elasticsearch Version 8.12

Additional context

I was thinking may be it is by design and should not be updated, but then it is strange that there is no notes in docs about this

At moment, if I understand correct, the workaround will be to rely on terraform password rotation, aka:

resource "time_rotating" "example" {
  rotation_days = 30
}

resource "elasticstack_elasticsearch_security_api_key" "example" {
  name             = "example"
  role_descriptors = jsonencode({})
  metadata         = jsonencode({})
  lifecycle {
    replace_triggered_by = [time_rotating.elastic-dev.id]
  }
  # expiration = "30d" # does not work as expceted, instead use lifecycle depending on time rotating resource
}
@mac2000 mac2000 added the bug Something isn't working label Nov 4, 2024
@Kushmaro Kushmaro added this to the 0.14.0 milestone Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants