tfstore

package module
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2022 License: MIT Imports: 6 Imported by: 0

README

tfstore

Create standard backend (S3+Dyanamodb) for terraform state files. https://www.terraform.io/docs/backends/types/s3.html

Install

  • Homebrew
$ brew tap youyo/tap
$ brew install tfstore

Other platforms are download from github release page.

Usage

  • simple way
$ tfstore
-------------------------------------
Creating stack...

bucket: tfstore-bucket-xxxxxxxxxxx
dynamodb_table: tfstore-DynamodbTable-xxxxxxxxxxx
region: ap-northeast-1
key: terraform.tfstate
encrypt: true

Terraform initialize command is

terraform init -backend-config 'bucket=tfstore-bucket-xxxxxxxxxxx' -backend-config 'dynamodb_table=tfstore-DynamodbTable-xxxxxxxxxxx' -backend-config 'key=terraform.tfstate' -backend-config 'region=ap-northeast-1' -backend-config 'encrypt=true'
-------------------------------------

$ terraform init -backend-config 'bucket=tfstore-bucket-xxxxxxxxxxx' -backend-config 'dynamodb_table=tfstore-DynamodbTable-xxxxxxxxxxx' -backend-config 'key=terraform.tfstate' -backend-config 'region=ap-northeast-1' -backend-config 'encrypt=true'
  • specific StackName
$ tfstore --stack-name custom-stack-name
.
.
.

Author

youyo

Documentation

Index

Constants

View Source
const (
	TfStateKey string = "terraform.tfstate"
	Encrypt    string = "true"
)
View Source
const Template string = `` /* 1560-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type TfStore

type TfStore struct {
	Session           *session.Session
	Region            string
	BucketName        string
	DynamodbTableName string
}

TfStore

func New

func New() *TfStore

New

func (*TfStore) Create

func (tf *TfStore) Create(ctx context.Context, stackName string) error

Create

func (*TfStore) GenerateCommandExample

func (tf *TfStore) GenerateCommandExample(ctx context.Context) string

GenerateCommandExample

func (*TfStore) GetOutput

func (tf *TfStore) GetOutput(ctx context.Context, stackName string) error

GetOutput

func (*TfStore) WaitCreation

func (tf *TfStore) WaitCreation(ctx context.Context, stackName string) error

Wait

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL