https://github.com/philips-labs/terraform-cloudfoundry-thanos
Experimental Thanos module for unlimited metrics storage on Cloud foundry
https://github.com/philips-labs/terraform-cloudfoundry-thanos
Last synced: 7 months ago
JSON representation
Experimental Thanos module for unlimited metrics storage on Cloud foundry
- Host: GitHub
- URL: https://github.com/philips-labs/terraform-cloudfoundry-thanos
- Owner: philips-labs
- License: mit
- Created: 2020-09-15T19:41:42.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-08-14T03:43:45.000Z (about 1 year ago)
- Last Synced: 2025-01-18T05:30:47.722Z (9 months ago)
- Language: HCL
- Homepage: https://registry.terraform.io/modules/philips-labs/thanos/cloudfoundry/latest
- Size: 489 KB
- Stars: 13
- Watchers: 4
- Forks: 14
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Terraform Cloudfoundry Thanos module
Setup for Prometheus + Thanos on Cloudfoundry. This provides a path towards unlimited metrics storage. This module deploys a number of apps and services to provide [Thanos](https://thanos.io)
## Disclaimer
> [!Important]
> This repository is managed as Philips Inner-source / Open-source.
> This repository is NOT endorsed or supported by HSSA&P or I&S Cloud Operations.
> You are expected to self-support or raise tickets on the Github project and NOT raise tickets in HSP ServiceNow.## Features
- Deploys a Thanos instance with S3 Bucket as storage
- Deploys a Compactor instance
- [Variant](https://github.com/philips-software/variant) sidecar for scrape target and rule discovery
- [Remote write](#input_enable_prometheus_proxy) support
- HSP Metrics exporter (optional)
- CF Metric exporter (optional)## Example of Thanos Terraform
```
module "thanos" {
source = "philips-labs/thanos/cloudfoundry"
version = "6.1.0"cf_org_name = var.cf_org_name
cf_space_id = var.cf_space_idcf_functional_account = {
api_endpoint = var.cf_api_url
username = var.cf_username
password = var.cf_password
}
}
```## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.3.0 |
| [cloudfoundry](#requirement\_cloudfoundry) | >= 0.15.5 |
| [hsdp](#requirement\_hsdp) | >= 0.38.2 |
| [random](#requirement\_random) | >= 2.2.1 |## Providers
| Name | Version |
|------|---------|
| [cloudfoundry](#provider\_cloudfoundry) | >= 0.15.5 |
| [hsdp](#provider\_hsdp) | >= 0.38.2 |
| [random](#provider\_random) | >= 2.2.1 |## Modules
| Name | Source | Version |
|------|--------|---------|
| [proxy](#module\_proxy) | ./modules/proxy | n/a |## Resources
| Name | Type |
|------|------|
| [cloudfoundry_app.cfpaasexporter](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/resources/app) | resource |
| [cloudfoundry_app.hsdp_metrics_exporter](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/resources/app) | resource |
| [cloudfoundry_app.thanos](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/resources/app) | resource |
| [cloudfoundry_app.thanos_compactor](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/resources/app) | resource |
| [cloudfoundry_app.thanos_query](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/resources/app) | resource |
| [cloudfoundry_app.thanos_store](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/resources/app) | resource |
| [cloudfoundry_network_policy.thanos_query](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/resources/network_policy) | resource |
| [cloudfoundry_network_policy.thanos_store](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/resources/network_policy) | resource |
| [cloudfoundry_route.cfpaasexporter_internal](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/resources/route) | resource |
| [cloudfoundry_route.hsdp_metrics_exporter_internal](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/resources/route) | resource |
| [cloudfoundry_route.thanos](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/resources/route) | resource |
| [cloudfoundry_route.thanos_internal](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/resources/route) | resource |
| [cloudfoundry_route.thanos_query](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/resources/route) | resource |
| [cloudfoundry_route.thanos_query_internal](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/resources/route) | resource |
| [cloudfoundry_route.thanos_store_internal](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/resources/route) | resource |
| [cloudfoundry_service_instance.s3](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/resources/service_instance) | resource |
| [cloudfoundry_service_key.s3](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/resources/service_key) | resource |
| [random_id.id](https://registry.terraform.io/providers/random/latest/docs/resources/id) | resource |
| [random_password.password](https://registry.terraform.io/providers/random/latest/docs/resources/password) | resource |
| [cloudfoundry_domain.app_domain](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/data-sources/domain) | data source |
| [cloudfoundry_domain.apps_internal_domain](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/data-sources/domain) | data source |
| [cloudfoundry_service.s3](https://registry.terraform.io/providers/cloudfoundry-community/cloudfoundry/latest/docs/data-sources/service) | data source |
| [hsdp_config.cf](https://registry.terraform.io/providers/philips-software/hsdp/latest/docs/data-sources/config) | data source |## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [alertmanagers\_endpoints](#input\_alertmanagers\_endpoints) | List of endpoints of the alert managers | `list(string)` | `[]` | no |
| [cf\_functional\_account](#input\_cf\_functional\_account) | Configuration for the CloudFoundry function account. Required for variant and if enable\_cf\_exporter is set to true |object({|
api_endpoint = string
username = string
password = string
}){| no |
"api_endpoint": "",
"password": "",
"username": ""
}
| [cf\_paas\_exporter\_disk\_quota](#input\_cf\_paas\_exporter\_disk\_quota) | CF PaaS Exporter disk quota | `number` | `100` | no |
| [cf\_paas\_exporter\_image](#input\_cf\_paas\_exporter\_image) | Image to use for cf paas exporter. Use a v* tagged version to prevent automatic updates | `string` | `"loafoe/paas-prometheus-exporter:v0.0.5"` | no |
| [cf\_paas\_exporter\_memory](#input\_cf\_paas\_exporter\_memory) | CF PaaS Exporter memory | `number` | `256` | no |
| [cf\_paas\_exporter\_timeout](#input\_cf\_paas\_exporter\_timeout) | CF PaaS Exporter timeout | `number` | `120` | no |
| [cf\_space\_id](#input\_cf\_space\_id) | Cloudfoundry SPACE id to use for deploying all Thanos components. | `string` | n/a | yes |
| [docker\_password](#input\_docker\_password) | Docker registry password | `string` | `""` | no |
| [docker\_username](#input\_docker\_username) | Docker registry username | `string` | `""` | no |
| [enable\_cf\_exporter](#input\_enable\_cf\_exporter) | Enable the CloudFoundry metrics exporter and scrape it from Thanos | `bool` | `false` | no |
| [enable\_hsdp\_metrics\_exporter](#input\_enable\_hsdp\_metrics\_exporter) | Enable scraping of HSDP Metrics instances | `bool` | `false` | no |
| [enable\_prometheus\_proxy](#input\_enable\_prometheus\_proxy) | Enable the Prometheus proxy, protected by Basic Auth | `bool` | `false` | no |
| [environment](#input\_environment) | Pass environment variable to the app | `map(any)` | `{}` | no |
| [hsdp\_metrics\_exporter](#input\_hsdp\_metrics\_exporter) | HSDP Metrics exporter configuration |object({|
image = string
docker_username = string
docker_password = string
memory = number
disk_quota = number
timeout = number
region = string
}){| no |
"disk_quota": 100,
"docker_password": "",
"docker_username": "",
"image": "loafoe/prometheus-hsdp-metrics-exporter:v0.0.14",
"memory": 256,
"region": "us-east",
"timeout": 120
}
| [name\_postfix](#input\_name\_postfix) | The postfix string to append to the space, hostname, etc. Prevents namespace clashes | `string` | `""` | no |
| [spaces](#input\_spaces) | The list of CF space GUIDs to scrape. When provided variant will only consider apps in these spaces | `list(string)` | `[]` | no |
| [tenants](#input\_tenants) | The list of tenants to scrape. When an app does not specify tenant then 'default' is used | `list(string)` |[| no |
"default"
]
| [thanos\_compactor\_disk\_quota](#input\_thanos\_compactor\_disk\_quota) | Thanos disk quota | `number` | `5000` | no |
| [thanos\_compactor\_enabled](#input\_thanos\_compactor\_enabled) | Enable or disable the Thanos compactor component | `bool` | `true` | no |
| [thanos\_compactor\_image](#input\_thanos\_compactor\_image) | Image to use for Thanos compactor. Use a v* tagged version to prevent automatic updates | `string` | `"ghcr.io/philips-labs/terraform-cloudfoundry-thanos:v6.5.0"` | no |
| [thanos\_compactor\_memory](#input\_thanos\_compactor\_memory) | Thanos store memory | `number` | `1024` | no |
| [thanos\_disk\_quota](#input\_thanos\_disk\_quota) | Thanos disk quota | `number` | `5000` | no |
| [thanos\_extra\_config](#input\_thanos\_extra\_config) | Any extra yaml config that will be merged into the prometheus config at runtime. Extra targets can be added here. | `string` | `""` | no |
| [thanos\_file\_sd\_url](#input\_thanos\_file\_sd\_url) | A URL that exposes a prometheus file\_sd yaml file will be periodically downloaded and used for service discovery | `string` | `""` | no |
| [thanos\_image](#input\_thanos\_image) | Image to use for Thanos app. Use a v* tagged version to prevent automatic updates | `string` | `"ghcr.io/philips-labs/terraform-cloudfoundry-thanos:v6.5.0"` | no |
| [thanos\_memory](#input\_thanos\_memory) | Thanos memory | `number` | `1024` | no |
| [thanos\_public\_endpoints](#input\_thanos\_public\_endpoints) | Make Thanos public endpoint | `bool` | `false` | no |
| [thanos\_query\_image](#input\_thanos\_query\_image) | Image to use for Thanos query. Use a v* tagged version to prevent automatic updates | `string` | `"ghcr.io/philips-labs/terraform-cloudfoundry-thanos:v6.5.0"` | no |
| [thanos\_query\_memory](#input\_thanos\_query\_memory) | Thanos memory | `number` | `1024` | no |
| [thanos\_query\_service\_bindings](#input\_thanos\_query\_service\_bindings) | A list of service instances that should be bound to the thanos app | `list(object({ service_instance = string }))` | `[]` | no |
| [thanos\_service\_bindings](#input\_thanos\_service\_bindings) | A list of service instances that should be bound to the thanos app | `list(object({ service_instance = string }))` | `[]` | no |
| [thanos\_storage\_tsdb\_retention\_time](#input\_thanos\_storage\_tsdb\_retention\_time) | Thanos storage tsdb retention time | `string` | `"2h"` | no |
| [thanos\_store\_disk\_quota](#input\_thanos\_store\_disk\_quota) | Thanos store disk quota | `number` | `5000` | no |
| [thanos\_store\_image](#input\_thanos\_store\_image) | Image to use for Thanos store. Use a v* tagged version to prevent automatic updates | `string` | `"ghcr.io/philips-labs/terraform-cloudfoundry-thanos:v6.5.0"` | no |
| [thanos\_store\_memory](#input\_thanos\_store\_memory) | Thanos store memory | `number` | `1536` | no |
| [thanos\_store\_service\_bindings](#input\_thanos\_store\_service\_bindings) | A list of service instances that should be bound to the thanos\_store app | `list(object({ service_instance = string }))` | `[]` | no |## Outputs
| Name | Description |
|------|-------------|
| [postfix](#output\_postfix) | Cluster ID / Postfix of Thanos deployment |
| [prometheus\_proxy\_endpoint](#output\_prometheus\_proxy\_endpoint) | The Promethues proxy endpoint |
| [prometheus\_proxy\_password](#output\_prometheus\_proxy\_password) | The Promethues proxy password |
| [prometheus\_proxy\_username](#output\_prometheus\_proxy\_username) | The Promethues proxy username |
| [thanos\_app\_id](#output\_thanos\_app\_id) | App id for Thanos |
| [thanos\_endpoint](#output\_thanos\_endpoint) | URL of Thanos deployment |
| [thanos\_query\_app\_id](#output\_thanos\_query\_app\_id) | App id for Thanos Query |
| [thanos\_query\_endpoint](#output\_thanos\_query\_endpoint) | URL of Thanos query deployment |
| [thanos\_space\_id](#output\_thanos\_space\_id) | Cloud foundry space ID of Thanos |
| [thanos\_store\_app\_id](#output\_thanos\_store\_app\_id) | App id for Thanos Store |
| [thanos\_store\_endpoint](#output\_thanos\_store\_endpoint) | Internal only URL of Thanos store deployment |# Contact / Getting help
Please post your questions on the HSDP Slack `#terraform` channel, or start a [discussion](https://github.com/philips-labs/terraform-cloudfoundry-thanos/discussions)
# License
License is MIT