Skip to content

feat(observability): add bearer token, tls config and honor labels/timestamps to scrape config - #1833

Open
ibrahimyesilay wants to merge 1 commit into
stackitcloud:mainfrom
ibrahimyesilay:feat/observability-scrapeconfig-auth-tls
Open

ibrahimyesilay wants to merge 1 commit into
stackitcloud:mainfrom
ibrahimyesilay:feat/observability-scrapeconfig-auth-tls

Conversation

@ibrahimyesilay

Copy link
Copy Markdown

Description

relates to #1832

First part of #1832: adds bearer_token, tls_config.insecure_skip_verify, honor_labels and honor_timestamps to stackit_observability_scrapeconfig (resource and data source).

Based on the review comments on #388 and on what the API returned in my tests (details in #1832):

  • bearer_token is sensitive and ConflictsWith basic_auth — the API rejects both together (at most one of basicAuth or bearerToken must be configured). The description mentions that the API only accepts JWT-formatted tokens.
  • honor_labels / honor_timestamps are optional + computed without a provider default; the API returns false when they are not set.
  • tls_config is optional. If insecure_skip_verify = false is configured and the API leaves the TLS config out of its response, the configured value is kept in state, so there is no inconsistent result.

metrics_relabel_configs will follow in a separate PR, as described in #1832.

Testing

  • Unit tests for the payloads (create and update), the mapping of the new fields and the TLS config mapping cases.
  • TestAccResourceMin (observability) extended: the scrape config sets all four fields, checked on create, data source and update (update switches insecure_skip_verify to false, flips the honor flags and changes the token). Run against a STACKIT project: PASS.
  • make fmt, make lint, make test, make generate-docs pass locally.

Checklist

  • Issue was linked above
  • Code format was applied: make fmt
  • Examples were added / adjusted (see examples/ directory)
  • Docs are up-to-date: make generate-docs (will be checked by CI)
  • Unit tests got implemented or updated
  • Acceptance tests got implemented or updated (see e.g. here)
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

…mestamps to scrape config

The Observability API supports `bearerToken`, `tlsConfig.insecureSkipVerify`,
`honorLabels` and `honorTimeStamps` on scrape configs, but the provider did
not expose them. Add them to the resource and the data source.

- `bearer_token` is sensitive and conflicts with `basic_auth`, since the API
  rejects both together.
- `honor_labels` and `honor_timestamps` are optional and computed, the API
  returns `false` when they are not set.
- A configured `tls_config` with `insecure_skip_verify = false` is kept in
  state if the API omits the TLS config in its response.

relates to stackitcloud#1832

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant