How can I add secret to the keystore using API

I deployed elastic cloud in Azure and now I'm trying to add keystore secret but not through UI as it will have to be automated in CI/CD.

Could you please advise how this can be achieved via either API or some remote command line tool, I'm currently using terraform provider for ec but doesn't look like it has this option

Does Secure your settings | Elasticsearch Service Documentation | Elastic help?

Hi @idelix

There is an issue open for this here perhaps you should add a comment.

Also there is a full REST API and you can add secrets to the keystore with that.

See Here and Here

1 Like

thanks that did the job for now:

curl -XPATCH https://api.elastic-cloud.com/api/v1/deployments/$1/elasticsearch/main-elasticsearch/keystore \
-H "Authorization: ApiKey $2" \
-H 'Content-Type: application/json' \
-d '
{
   "secrets" : {
      "<property name>" : {
         "as_file" : false,
         "value" : "'"$3"'"
      }
   }
}
'
1 Like

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