loki
loki copied to clipboard
feat: Prevent lambda-promtail from recompiling on every plan
What this PR does / why we need it:
Currently, if you deploy lambda-promtail using the provided Terraform code, every time you run terraform plan, the golang binary will be recompiled and you will never have a clean plan. Ideally, the binary should only be recompiled if the code actually changes compared to the last apply.
If the code was just a single file, we could use a hash of the script as the trigger, but we have too many files to make hashing feasible. Terraform won't let you hash every file in a folder natively, you'd have to add a third-party module or write a script yourself.
So instead, I've added a new variable, lambda_code_version, which if set, will be used as the trigger for determining when the code should be recompiled. I've added an example to the README.
Special notes for your reviewer:
n/a
Checklist
- [x] Reviewed the
CONTRIBUTING.mdguide (required) - [x] Documentation added
- [x] Tests updated
- [x] Title matches the required conventional commits format, see here
- Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such,
featPRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
- Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such,
- [x] Changes that require user attention or interaction to upgrade are documented in
docs/sources/setup/upgrade/_index.md - [x] If the change is deprecating or removing a configuration option, update the
deprecated-config.yamlanddeleted-config.yamlfiles respectively in thetools/deprecated-config-checkerdirectory. Example PR
@mchaffee-anaconda as of https://github.com/grafana/loki/pull/18531, the lambda-promtail code has moved to its own repo as another team is taking ownership of it. Could you re-open your PR against the new lambda promtail repo please?