# Creating Secrets in Elastic Fleet

**URL:** https://discuss.elastic.co/t/creating-secrets-in-elastic-fleet/352116
**Category:** Kibana
**Tags:** fleet
**Created:** [January 30, 2024, 6:24pm UTC](https://discuss.elastic.co/t/creating-secrets-in-elastic-fleet/352116 "2024-01-30T18:24:43Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![DougR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dougr/32/48095_2.png) [@DougR](https://discuss.elastic.co/u/DougR)
#### Post date: [January 30, 2024, 6:24pm UTC](https://discuss.elastic.co/t/creating-secrets-in-elastic-fleet/352116/1 "2024-01-30T18:24:43Z")

</div>

I'm using Elastic Cloud v8.12.0. Documentation for Fleet gives instructions on how to use a Fleet secret in an integration policy, but how to I actually CREATE one? I can't find the information in the documentation.

> **[Elastic Agent policies | Elastic Docs](https://www.elastic.co/docs/reference/fleet/agent-policy)**
>
> A policy is a collection of inputs and settings that defines the data to be collected by an Elastic Agent. Each Elastic Agent can only be enrolled in...

# Edit

OK - after reading the documentation and the discussion on Github more closely, it appears that there's no mechanism to create a secret and then consume it, the magic happens when an integration that supports secrets is saved from the Fleet UI, is this correct? In other words secret is created and the appropriate key is substituted when an integration which supports secrets is deployed, is this right?

Thx.

---

<div class="post-metadata">

### Author: ![Julia\_Bardi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/julia_bardi/32/79463_2.png) [@Julia\_Bardi](https://discuss.elastic.co/u/Julia_Bardi)
#### Post date: [January 31, 2024, 9:14am UTC](https://discuss.elastic.co/t/creating-secrets-in-elastic-fleet/352116/2 "2024-01-31T09:14:35Z")

</div>

Hi DougR,

Yes, currently only integrations that mark variables as secret are going to be stored as secrets.

---

<div class="post-metadata">

### Author: ![DougR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dougr/32/48095_2.png) [@DougR](https://discuss.elastic.co/u/DougR)
#### Post date: [January 31, 2024, 1:56pm UTC](https://discuss.elastic.co/t/creating-secrets-in-elastic-fleet/352116/3 "2024-01-31T13:56:33Z")

</div>

> [@Julia\_Bardi](#):
>
> Yes, currently only integrations that mark variables as secret are going to be stored as secrets.

Are there plans to create a generic secret vault in order to make secrets available for use? E.g., I can specify `MYAPP_PROD_USERNAME` in the vault and reference it in my configuration as `${MYAPP_PROD_USERNAME}`?

Our use case is that we are moving to using the Elasticstack Terraform Provider to manage our stack (including policies) so that we can place our configuration under version control. Using the postgres integration as an example, if I utilize the provider to push a password as part of my configuration and the integration immediately places it into the vault and replaces it with a reference such as `${SECRET_0}`, then this creates configuration drift which will result in the configuration being updated the next time the terraform configuration is applied.

An alternative would be a way to allow a user to specify environment variables in the policy (or for the agent) which could be accessed with the `env` provider.

Thx.

---

<div class="post-metadata">

### Author: ![Julia\_Bardi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/julia_bardi/32/79463_2.png) [@Julia\_Bardi](https://discuss.elastic.co/u/Julia_Bardi)
#### Post date: [January 31, 2024, 2:43pm UTC](https://discuss.elastic.co/t/creating-secrets-in-elastic-fleet/352116/4 "2024-01-31T14:43:45Z")

</div>

I'm not aware of any plans as of now, but you are welcome to raise a feature request [here](https://github.com/elastic/kibana/issues/new?assignees=&labels=&projects=&template=Feature_request.md), and we will evaluate the feasibility.

---

<div class="post-metadata">

### Author: ![DougR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dougr/32/48095_2.png) [@DougR](https://discuss.elastic.co/u/DougR)
#### Post date: [January 31, 2024, 4:01pm UTC](https://discuss.elastic.co/t/creating-secrets-in-elastic-fleet/352116/5 "2024-01-31T16:01:56Z")

</div>

> [@Julia\_Bardi](#):
>
> I'm not aware of any plans as of now, but you are welcome to raise a feature request [here](https://github.com/elastic/kibana/issues/new?assignees=&labels=&projects=&template=Feature_request.md), and we will evaluate the feasibility.

Submitted [here](https://github.com/elastic/kibana/issues/175997).

Thank you for your response and clarification.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [February 28, 2024, 4:02pm UTC](https://discuss.elastic.co/t/creating-secrets-in-elastic-fleet/352116/6 "2024-02-28T16:02:08Z")

</div>

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