Update elasticsearch.yml in elastic cloud through API


I deployed Elastic Cloud in Azure using terraform provider hovewer I cannot use terraform to update elasticsearch.yml (below) since OpenID configuration (Secure your clusters with OpenID Connect | Elasticsearch Service Documentation | Elastic) requires keystore secret to be added first otherwise setting change fails.

 config {
   user_settings_yaml = data.template_file.elasticsearch_settings.rendered

So I need to update elasticsearch.yml after cluster is created and currently I couldn't find way to do it.

I know I can see API version of my deployment and I saw how you can for example add Kibana through API Create a first deployment: Just an Elasticsearch cluster | Elastic Cloud Enterprise Reference [2.10] | Elastic but I cannot find any example of adding settings.

Guess I could obtain deployment as json then parse it and try to add user settings but thought there must be easier way

This is indeed a rough area of our Terraform implementation

Currently Terraform cannot support Keystore insertion (and our API does not support Keystore insertion on creation, only on update)

Therefore the steps are:

We are aware this isn't an ideal experience for a fairly common operation, and are actively discussing how future versions can improve on this


1 Like

Thanks for information the problem is it is not possible to change configuration inside terraform without code change and pushing this change to repository.

Ideally I would just update config through API after terraform finished deploying cluster and also after I already added secret using API.

I found this instruction of how to upgrade deployment Applying a new deployment configuration: Upgrade | Elastic Cloud Enterprise Reference [2.10] | Elastic but I only need to update config so wonder if you have some example of how this can be acomplished.

Actually I think it will be fine I can add settings using dynamic block in terraform and just run terraform twice with diff parameters second after I added keystore secret

    dynamic "config" {
      for_each = var.enable_elasticsearch_config ? [1] : []
      content {
        user_settings_yaml = data.template_file.elasticsearch_settings.rendered
1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.