Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Terraform State Storage API

License

NotificationsYou must be signed in to change notification settings

tfstate/github-sls-rest-api

Repository files navigation

TFstate.dev is a freeTerraform State Provider andOpen Source Hosted Service for secure Terraform Remote State hosting using a GitHub Token, courtsey ofScaffoldly

Features:

  • GitHub Token used for Authentication and Authorization to Terraform State
  • Encrypted State in Amazon S3 using Amazon KMS
  • State Locking
  • Highly availableHosted API in AWS Lambda + API Gateway
  • Plug and Play: Only a GitHub Token is needed to use TFstate.dev

✅ We do not store or save the provided GitHub token.


Getting started 🚀

First, a GitHub token is needed. This can be aPersonal Access Token, aGitHub Actions Secret, or any other form ofGitHub Oauth Token. At a minimum, the token needsrepo:read access for the configured repository.

➡ See ourexample repository.

To use TFstate.dev in Terraform, add the followingbackend configuration to Terraform:

terraform {backend"http" {address="https://api.tfstate.dev/github/v1"lock_address="https://api.tfstate.dev/github/v1/lock"unlock_address="https://api.tfstate.dev/github/v1/lock"lock_method="PUT"unlock_method="DELETE"username="{your-github-org}/{your-github-repo}"  }}

Then, Terraform can be configured to use the TFstate.dev backend using the GitHub token:

terraform init -backend-config="password={your-github-token}"terraform planterraform apply

Alternatively, theTF_HTTP_PASSWORD environment variable can be set with the GitHub token:

export TF_HTTP_PASSWORD="{your-github-token}"terraform initterraform planterraform apply

For more information go toTFstate.dev!


Want to Contribute?

Developing/Contributing to this API

We'd love contributions from the community to improve this API.

Running

Requirements:

  • NodeJS 14+
  • Yarn

Running instructions:

  1. Fork and clone this repo
  2. Runyarn
  3. Runyarn start (launches Serverless in Local mode)

The main controller isControllerV1. It contains the primary endpoints for State Storage.

Once running locally, the OpenAPI docs can be found at:

https://localhost:3000/github/swagger.html

Verifying Locally

While running the API locally, create a basic Terraform structure to test state functions:

terraform {backend"http" {address="http://localhost:3000/github/v1"lock_address="http://localhost:3000/github/v1/lock"unlock_address="http://localhost:3000/github/v1/lock"lock_method="PUT"unlock_method="DELETE"# Make sure this is a real repository that your token has access tousername="{your-github-user}/github-sls-rest-api"  }}resource"null_resource""example" {}output"null_resource_id" {value=null_resource.example.id}

Then, run:

export TF_HTTP_PASSWORD={your-github-token}terraform initterraform planterraform apply

Other command to verify with:

terraform state ...terraform force-unlock ...

Contributing Guidelines

SeeCONTRIBUTING

Maintainers

License

Copyright 2022 Scaffoldly LLC

Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.


[8]ページ先頭

©2009-2025 Movatter.jp