/terraform-cloudfoundry-thanos

Experimental Thanos module for unlimited metrics storage on HSDP

Primary LanguageHCLMIT LicenseMIT

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

Features

  • Deploys a Thanos instance with S3 Bucket as storage
  • Variant sidecar for scrape target and rule discovery
  • Alertmanager support
  • Teams notification support

Example of Thanos Terraform

module "thanos" {
    source = "philips-labs/thanos/cloudfoundry"
    version = "4.2.0"

    cf_org_name        = var.cf_org_name
    cf_space_id        = var.cf_space_id

    cf_functional_account = {
      api_endpoint = var.cf_api_url
      username     = var.cf_username
      password     = var.cf_password
    }
}

Requirements

Name Version
terraform >= 0.13.0
cloudfoundry >= 0.14.2
hsdp >= 0.18.1
random >= 2.2.1

Providers

Name Version
cloudfoundry >= 0.14.2
hsdp >= 0.18.1
random >= 2.2.1

Modules

No modules.

Resources

Name Type
cloudfoundry_app.alertmanager resource
cloudfoundry_app.cfpaasexporter resource
cloudfoundry_app.prometheusmsteams resource
cloudfoundry_app.thanos resource
cloudfoundry_app.thanos_query resource
cloudfoundry_app.thanos_store resource
cloudfoundry_network_policy.alertmanager resource
cloudfoundry_network_policy.cfpaasexporter resource
cloudfoundry_network_policy.prometheusmsteams resource
cloudfoundry_network_policy.thanos_query resource
cloudfoundry_network_policy.thanos_store resource
cloudfoundry_route.alertmanager_internal resource
cloudfoundry_route.cfpaasexporter_internal resource
cloudfoundry_route.prometheusmsteams_internal resource
cloudfoundry_route.thanos resource
cloudfoundry_route.thanos_internal resource
cloudfoundry_route.thanos_query resource
cloudfoundry_route.thanos_query_internal resource
cloudfoundry_route.thanos_store_internal resource
cloudfoundry_service_instance.s3 resource
random_id.id resource
random_password.password resource
cloudfoundry_domain.app_domain data source
cloudfoundry_domain.apps_internal_domain data source
cloudfoundry_org.org data source
cloudfoundry_service.s3 data source
hsdp_config.cf data source

Inputs

Name Description Type Default Required
alertmanager_config Alertmanager config string "" no
alertmanager_image Image to use for Alertmanager string "prom/alertmanager:v0.23.0" no
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
})
{
"api_endpoint": "",
"password": "",
"username": ""
}
no
cf_org_name Cloudfoundry ORG name to use for reverse proxy string n/a yes
cf_paas_exporter_disk_quota CF PaaS Exporter disk quota number 100 no
cf_paas_exporter_image Image to use for cf paas exporter. Use a v* tagged version to prevent automatic updates string "philipslabs/paas-prometheus-exporter:latest" no
cf_paas_exporter_memory CF PaaS Exporter memory number 256 no
cf_space_id Cloudfoundry SPACE id to use for deploying all Thanos components. string n/a yes
docker_password Docker registry password string "" no
docker_username Docker registry username string "" no
enable_cf_exporter Enable the CloudFoundry metrics exporter and scrape it from Thanos bool false no
environment Pass environment variable to the app map(any) {} no
name_postfix The postfix string to append to the space, hostname, etc. Prevents namespace clashes string "" no
teams_incoming_webhook_url Teams incoming webhook URL string "" no
tenants The list of tenants to scrape. When an app does not specify tenant then 'default' is used list(string)
[
"default"
]
no
thanos_disk_quota Thanos disk quota number 5000 no
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 A URL that exposes a prometheus file_sd yaml file will be periodically downloaded and used for service discovery string "" no
thanos_image Image to use for Thanos app. Use a v* tagged version to prevent automatic updates string "philipslabs/cf-thanos:v4.3.6" no
thanos_memory Thanos memory number 1024 no
thanos_public_endpoints Make Thanos public endpoint bool false no
thanos_query_image Image to use for Thanos query. Use a v* tagged version to prevent automatic updates string "philipslabs/cf-thanos:v4.3.6" no
thanos_store_disk_quota Thanos store disk quota number 5000 no
thanos_store_image Image to use for Thanos store. Use a v* tagged version to prevent automatic updates string "philipslabs/cf-thanos:v4.3.6" no
thanos_store_memory Thanos store memory number 1536 no

Outputs

Name Description
alertmanager_app_id App id of Alertmanager
alertmanager_internal_endpoint Internal route of alertmanager
postfix Cluster ID / Postfix of Thanos deployment
thanos_app_id App id for Thanos
thanos_endpoint URL of Thanos deployment
thanos_query_app_id App id for Thanos Query
thanos_query_endpoint URL of Thanos query deployment
thanos_space_id Cloud foundry space ID of Thanos
thanos_store_app_id App id for Thanos Store
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

License

License is MIT