{"id":27205972,"url":"https://github.com/kamuridesu/tf-backend-go","last_synced_at":"2026-04-11T11:01:49.840Z","repository":{"id":222905208,"uuid":"758694093","full_name":"kamuridesu/tf-backend-go","owner":"kamuridesu","description":"Custom HTTP backend for Terraform/OpenTofu in Go with AWS Lambda support","archived":false,"fork":false,"pushed_at":"2025-01-15T17:46:41.000Z","size":68,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T23:06:52.603Z","etag":null,"topics":["aws","dynamodb","gin-gonic","go","golang","lambda","postgresql","sqlite","terraform"],"latest_commit_sha":null,"homepage":"","language":"Go","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/kamuridesu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2024-02-16T21:29:41.000Z","updated_at":"2025-01-15T17:46:43.000Z","dependencies_parsed_at":"2024-02-16T23:16:57.663Z","dependency_job_id":"f38108f5-c02d-45db-a8ac-ee4889800a81","html_url":"https://github.com/kamuridesu/tf-backend-go","commit_stats":null,"previous_names":["kamuridesu/tf-backend-go"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamuridesu%2Ftf-backend-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamuridesu%2Ftf-backend-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamuridesu%2Ftf-backend-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamuridesu%2Ftf-backend-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kamuridesu","download_url":"https://codeload.github.com/kamuridesu/tf-backend-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125625,"owners_count":21051770,"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":["aws","dynamodb","gin-gonic","go","golang","lambda","postgresql","sqlite","terraform"],"created_at":"2025-04-09T23:06:55.810Z","updated_at":"2026-04-11T11:01:44.801Z","avatar_url":"https://github.com/kamuridesu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TF Backend Go\n\nA jump to the sky turns to a Rider Kick\n\n## Intro\n\nA simple HTTP backend to store Terraform/OpenTofu state information using SQLite or Postgres as database.\nIt also works as an AWS Lambda Serverless service using API Gateway as HTTP frontend and DynamoDB as storage.\n\n## Build\n\n\n### Linux\n```\nCGO_ENABLED=1 go build -ldflags='-s -w -extldflags \"-static\"' -o tf-backend\n```\n\n### Lambda\n\nJust run the `build.sh` script to generate the main.zip file. In case you want to run the commands yourself:\n```sh\nCGO_ENABLED=0 go build -ldflags='-s -w -extldflags \"-static\"' -o bootstrap  # Build project\nzip main.zip bootstrap  # Stores it into a main.zip file\nrm bootstrap  # removes the executable file\n```\n\nIn case you're using Windows, just follow this documentation: https://docs.aws.amazon.com/lambda/latest/dg/golang-package.html#golang-package-windows\n\n## AWS Setup\n\n### Lambda\n\nCreate a new Lambda Function, give it the name you want and as for the runtime select `Amazon Linux 2023`. Choose the arch compatible with your build and click Create Function.\n\nThen, in Configurations -\u003e Environment Variables, add these following variables:\n```\nACCESS_KEY=\nSECRET_ACCESS_KEY=\nAUTH_USERS=\n```\nThe access key and secret access key should be created on AWS. Just follow the docs. For the AUTH_USERS env it should be in this format: USER:PASSWORD;USER2:PASSWORD2\n\nThen just upload the .zip file containing the executable.\n\n### API Gateway\n\n\n#### New API gateway\nClick Create API, then HTTP API. Add Lambda integration and search for the Lambda Function you created. Select it and give it a name. \n\nThen create a route that starts with / and another that starts with /{proxy+}, the later will be used to give a name to the Terraform State. The method for all routes should be `ANY`.\n\nAfter creating the routes just integrate it with the Lambda Function you created. Get the URL clicking on Deploy -\u003e Stages.\n\n#### Existing API Gateway\nIf you already has an API Gateway, just setup it to use {proxy+} in a route and integrate it to the lambda function. Remember, the method should be ANY.\n\n### DynamoDB\n\nCreate a new table called `tfstates` with Name as Partition Key and Locked as Sort Key. Leave the other options as default.\n\n## Routes\n\n- `tfstates/:name` -\u003e route for Terraform Operations\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkamuridesu%2Ftf-backend-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkamuridesu%2Ftf-backend-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkamuridesu%2Ftf-backend-go/lists"}