{"id":20163455,"url":"https://github.com/sjinks/tfhttp","last_synced_at":"2026-05-15T05:11:06.530Z","repository":{"id":217015508,"uuid":"742935292","full_name":"sjinks/tfhttp","owner":"sjinks","description":"Terraform HTTP Backend written in C++","archived":false,"fork":false,"pushed_at":"2024-04-23T01:40:46.000Z","size":137,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-24T03:16:53.134Z","etag":null,"topics":["async","cplusplus","cplusplus-20","cpp","terraform","terraform-backend","terraform-backend-http","terraform-backends","terraform-http-backend"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sjinks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"custom":["https://www.paypal.com/donate/?hosted_button_id=SAG6877JDJ3KU"]}},"created_at":"2024-01-13T20:03:02.000Z","updated_at":"2024-04-25T14:33:59.400Z","dependencies_parsed_at":"2024-04-25T14:44:07.938Z","dependency_job_id":null,"html_url":"https://github.com/sjinks/tfhttp","commit_stats":null,"previous_names":["sjinks/tfhttp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjinks%2Ftfhttp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjinks%2Ftfhttp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjinks%2Ftfhttp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjinks%2Ftfhttp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sjinks","download_url":"https://codeload.github.com/sjinks/tfhttp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241600493,"owners_count":19988715,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","cplusplus","cplusplus-20","cpp","terraform","terraform-backend","terraform-backend-http","terraform-backends","terraform-http-backend"],"created_at":"2024-11-14T00:29:41.234Z","updated_at":"2026-05-15T05:11:06.481Z","avatar_url":"https://github.com/sjinks.png","language":"C++","funding_links":["https://www.paypal.com/donate/?hosted_button_id=SAG6877JDJ3KU"],"categories":[],"sub_categories":[],"readme":"# Terraform HTTP Backend\n\n[![CodeQL](https://github.com/sjinks/tfhttp/actions/workflows/codeql.yml/badge.svg)](https://github.com/sjinks/tfhttp/actions/workflows/codeql.yml)\n[![SonarCloud](https://github.com/sjinks/tfhttp/actions/workflows/sonarcloud.yml/badge.svg)](https://github.com/sjinks/tfhttp/actions/workflows/sonarcloud.yml)\n[![Static Code Analysis](https://github.com/sjinks/tfhttp/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/sjinks/tfhttp/actions/workflows/static-analysis.yml)\n\nA state backend server that implements the [Terraform HTTP backend API](https://developer.hashicorp.com/terraform/language/settings/backends/http). This server does not handle authentication and should be used behind a reverse proxy (like nginx).\n\nThe server is rather an experiment in writing HTTP servers in C++. It is probably OK for hobby usage but not for mission-critical applications.\n\n## Build\n\ntl;dr: see [Dockerfile](Dockerfile).\n\n1. Install required dependencies: clang++ or g++, cmake, make.\n2. Install optional dependencies: [libev](http://dist.schmorp.de/libev/), [ada](https://github.com/ada-url/ada), [nanodbc](https://github.com/nanodbc/nanodbc), [llhttp](https://github.com/nodejs/llhttp), [json](https://github.com/nlohmann/json), [libretls](https://git.causal.agency/libretls).\n3. If you don't install the optional dependencies, the system will try to download and build them. In this case, it may need `git`, `python3`, `python3-whichcraft` (for Ada), `unixodbc` (for nanodbc), and `openssl` (for LibreTLS). See [Dockerfile](Dockerfile) for details.\n4. Build: `cmake -B build -DCMAKE_BUILD_TYPE=MinSizeRel \u0026\u0026 cmake --build build`.\n\n## Usage\n\nThe following environment variables control the server:\n* `TFHTTP_ADDRESS`: IP address the server will listen on. The default value is `0.0.0.0` (listen on all IP‌ addresses).\n* `TFHTTP_PORT`: port the server will listen on. The default value is `3000`.\n* `TFHTTP_DSN`: the data source name to request a connection to an ODBC Data Source. By default, it is `Driver={SQLite3};Database=:memory:` (an [in-memory SQLite3 database](https://www.sqlite.org/inmemorydb.html) that does not survive application restarts). You will need to have the corresponding ODBC connector installed.\n* `TFHTTP_HTTPS`: set to `1` to enable HTTPS.\n* `TFHTTP_CERTIFICATE`: path to the TLS certificate.\n* `TFHTTP_PRIVATE_KEY`: path to the TLS certificate key.\n* `TFHTTP_CA_CERTIFICATE`: path to the CA certificate.\n* `TFHTTP_TRUSTED_CERTIFICATE`: path to the trusted certificate (used for OCSP stapling).\n* `TFHTTP_TLS_PROTOCOLS`: a comma- or colon-delimited list of the TLS‌ protocols to use. The valid values are `tlsv1.0`, `tlsv1.1`, `tlsv1.2`, `tlsv1.3`, `all`, `default`, `legacy`, `secure`. See [`tls_config_parse_protocols(3)`](https://man.openbsd.org/tls_config_parse_protocols.3).\n* `TFHTTP_TLS_CIPHERS`: list of the allowed ciphers. The valid values are `secure`, `default`, `compat`, `legacy`, `insecure`, `all`, or a libssl ciper string. See [`tls_config_set_ciphers(3)`](https://man.openbsd.org/tls_config_set_ciphers.3).\n* `TFHTTP_TLS_CURVES`: a comma-separated list of the elliptic curves used during ECDHE key exchange. See [`tls_config_set_ecdhecurves(3)`](https://man.openbsd.org/tls_config_set_ecdhecurves.3).\n* `TFHTTP_TLS_VERIFY_CLIENT`: set to `1` to enable client certificate verification, requiring the client to send a certificate.\n* `TFHTTP_TLS_ENABLE_DHE`: set to `1` to enable DHE key exchange.\n\n## Endpoints\n\nThe server provides the following endpoints:\n* `GET /:project/state`: fetch Terraform state for the given `project`. The state will be created if it does not exist.\n* `POST /:project/state`: save Terraform state for the given `project`.\n* `DELETE /:project/state`: delete Terraform state for the given `project`.\n* `LOCK /:project`: lock state.\n* `UNLOCK /:project`: unlock state.\n\n`:project` is an alphanumeric string matching the `[A-Za-z0-9_-]+` regular expression. This makes is possible to use this server for multiple Terraform projects.\n\n## Sample Terraform Configuration\n\n```hcl\nterraform {\n  backend \"http\" {\n    address = \"http://127.0.0.1:3000/myproject/state\"\n    lock_address = \"http://127.0.0.1:3000/myproject\"\n    unlock_address = \"http://127.0.0.1:3000/myproject\"\n  }\n}\n```\n\n([More details](https://developer.hashicorp.com/terraform/language/settings/backends/http#configuration-variables)).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjinks%2Ftfhttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsjinks%2Ftfhttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjinks%2Ftfhttp/lists"}