From b444364b6e928611372c8130e79dff6a3a415a57 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 21:27:32 +0200 Subject: [PATCH] [release/v1.2] Update local.file.md (#2111) * Update local.file.md when trying to use `local.file` it seemed to be missing an example of how to use it. * Update docs/sources/reference/components/local/local.file.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * Update docs/sources/reference/components/local/local.file.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * Fixed the workding of the example --------- Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> (cherry picked from commit 2eecbfe56cead4dc1978bc3adef507945fbff06d) Co-authored-by: Bob Cotton --- docs/sources/reference/components/local/local.file.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/sources/reference/components/local/local.file.md b/docs/sources/reference/components/local/local.file.md index 392b23fceb..08edc29f9b 100644 --- a/docs/sources/reference/components/local/local.file.md +++ b/docs/sources/reference/components/local/local.file.md @@ -46,7 +46,9 @@ Name | Type | Description ----------|----------------------|--------------------------------------------------- `content` | `string` or `secret` | The contents of the file from the most recent read -The `content` field will have the `secret` type only if the `is_secret` argument was true. +The `content` field will have the `secret` type only if the `is_secret` argument was true. + +You can use `local.file.LABEL.content` to access the contents of the file. ## Component health @@ -66,9 +68,15 @@ The read error will be exposed as a log message and in the debug information for ## Example +The following example shows a simple `local.file` configuration that watches a passwords text file and uses the exported content field. + ```alloy local.file "secret_key" { filename = "/var/secrets/password.txt" is_secret = true } +grafana_cloud.stack "receivers" { + stack_name = "mystack" + token = local.file.secret_key.content +} ```