Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fgouteroux/terraform-provider-loki
This terraform provider allows you to interact with grafana loki.
https://github.com/fgouteroux/terraform-provider-loki
grafana loki terraform terraform-provider
Last synced: about 1 month ago
JSON representation
This terraform provider allows you to interact with grafana loki.
- Host: GitHub
- URL: https://github.com/fgouteroux/terraform-provider-loki
- Owner: fgouteroux
- License: apache-2.0
- Created: 2023-07-25T07:27:41.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-12T14:42:01.000Z (5 months ago)
- Last Synced: 2024-07-13T11:02:06.188Z (5 months ago)
- Topics: grafana, loki, terraform, terraform-provider
- Language: Go
- Homepage: https://registry.terraform.io/providers/fgouteroux/loki/latest/docs
- Size: 158 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Terraform provider for grafana loki
This terraform provider allows you to interact with grafana loki.
See [Loki API Reference](https://grafana.com/docs/loki/latest/api/)
## Provider `loki`
Example:
```
provider "loki" {
uri = "http://localhost:3100"
org_id = "mytenant"
}
```### Authentication
Grafana Loki have no authentication support, so this is delegated to a reverse proxy.
The provider support basic auth, token.
#### Basic auth
```
provider "loki" {
uri = "http://localhost:3100"
org_id = "mytenant"
username = "user"
password = "password"
}
```#### Token
```
provider "loki" {
uri = "http://localhost:3100"
org_id = "mytenant"
token = "supersecrettoken"
}
```### Headers
```
provider "loki" {
uri = "http://localhost:3100"
org_id = "mytenant"
header = {
"Custom-Auth" = "Custom value"
}
}
```## Resource `loki_rule_group_alerting`
Example:
```
resource "loki_rule_group_alerting" "test" {
name = "test1"
namespace = "namespace1"
rule {
alert = "HighPercentageError"
expr = < 0.05
for = "10m"
labels = {
severity = "warning"
}
annotations = {
summary = "High request latency"
}
}
}
```## Resource `loki_rule_group_recording`
Example:
```
resource "loki_rule_group_recording" "record" {
name = "test1"
namespace = "namespace1"
interval = "1m"
rule {
expr = "sum(rate({container=\"nginx\"}[1m]))"
record = "nginx:requests:rate1m"
}
}
```## Importing existing resources
This provider supports importing existing resources into the terraform state. Import is done according to the various provider/resource configuation settings to contact the API server and obtain data.### loki alerting rule group
To import loki rule group alerting
The id is build as `/`Example:
```
terraform import 'loki_rule_group_alerting.alert1' namespace1/alert1
loki_rule_group_alerting.alert1: Importing from ID "namespace1/alert1"...
loki_rule_group_alerting.alert1: Import prepared!
Prepared loki_rule_group_alerting for import
loki_rule_group_alerting.alert1: Refreshing state... [id=namespace1/alert1]Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.```
### loki recording rule group
To import loki rule group recording
The id is build as `/`Example:
```
terraform import 'loki_rule_group_recording.record1' namespace1/record1
loki_rule_group_recording.record1: Importing from ID "namespace1/record1"...
loki_rule_group_recording.record1: Import prepared!
Prepared loki_rule_group_recording for import
loki_rule_group_recording.record1: Refreshing state... [id=namespace1/record1]Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.```
## Contributing
Pull requests are always welcome! Please be sure the following things are taken care of with your pull request:
* `go fmt` is run before pushing
* Be sure to add a test case for new functionality (or explain why this cannot be done)