From 27e89038576196bd8639fc139eb887afccc9099f Mon Sep 17 00:00:00 2001 From: Bob Cotton Date: Fri, 15 Nov 2024 12:19:24 -0700 Subject: [PATCH] Update local.file.md (#2072) * 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) --- 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 +} ```