# Apm server configured by elastic operator ignore ${SECRET\_TOKEN} variable

**URL:** <https://discuss.elastic.co/t/apm-server-configured-by-elastic-operator-ignore-secret-token-variable/350305>\
**Category:** APM\
**Tags:** server\
**Created:** [January 3, 2024, 1:27pm UTC](https://discuss.elastic.co/t/apm-server-configured-by-elastic-operator-ignore-secret-token-variable/350305 "2024-01-03T13:27:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hetii](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hetii/32/130497_2.png) [@hetii](https://discuss.elastic.co/u/hetii)\
**Post date:** [January 3, 2024, 1:27pm UTC](https://discuss.elastic.co/t/apm-server-configured-by-elastic-operator-ignore-secret-token-variable/350305/1 "2024-01-03T13:27:38Z")

</div>

Hi 😉

For code like below Apm server configured by elastic operator ignore ${SECRET\_TOKEN} variable.

```auto
apiVersion: apm.k8s.elastic.co/v1
kind: ApmServer
metadata:
  name: apm-server
  namespace: elfstack
spec:
  version: 8.11.3
  count: 1
  elasticsearchRef:
    name: monitoring
  kibanaRef:
    name: monitoring

```

As I check the container, there is a secret mounted as config/config-secret/apm-server.yml where the ${SECRET\_TOKEN} variable is used for key:  
`apm-server.secret_token` instead `apm-server.auth.secret_token`.

This bug makes the apm server wide open.

As a workaround I use such code:

```auto
---
apiVersion: apm.k8s.elastic.co/v1
kind: ApmServer
metadata:
  name: apm-server
  namespace: elfstack
spec:
  version: 8.11.3
  count: 1
  elasticsearchRef:
    name: monitoring
  kibanaRef:
    name: monitoring
  podTemplate:
    spec:
      containers:
      - name: apm-server
        command:
        - sh
        - -c
        - |
          sed -e s/secret_token/"auth:\n secret_token"/g config/config-secret/..data/apm-server.yml > config/apm-fixed-server.yml
          exec apm-server run -e -c config/apm-fixed-server.yml

```

Best Regards.

---

<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:** [January 31, 2024, 1:28pm UTC](https://discuss.elastic.co/t/apm-server-configured-by-elastic-operator-ignore-secret-token-variable/350305/2 "2024-01-31T13:28:02Z")

</div>

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