All Projects → turnerlabs → terraform-remote-state

turnerlabs / terraform-remote-state

Licence: other
A Terraform module that configures an s3 bucket for use with Terraform's remote state feature

Programming Languages

HCL
1544 projects

Projects that are alternatives of or similar to terraform-remote-state

punic
Punic is a remote cache CLI built for Carthage and Apple .xcframework
Stars: ✭ 25 (+19.05%)
Mutual labels:  s3, remote
SuperGrate
💾 Get moving with Super Grate; a free & open source Windows Profile Migration & Backup Utility. Super Grate is a GUI (Graphical User Interface) that assists Microsoft's USMT (User State Migration Utility) in performing remote migrations over a network connection.
Stars: ✭ 91 (+333.33%)
Mutual labels:  state, remote
terraform-aws-s3
Terraform module to create default S3 bucket with logging and encryption type specific features.
Stars: ✭ 22 (+4.76%)
Mutual labels:  module, s3
portera
Remote logs
Stars: ✭ 22 (+4.76%)
Mutual labels:  remote
PythonKeylogger
A remote keylogger with some cool features
Stars: ✭ 38 (+80.95%)
Mutual labels:  remote
minback-postgres
A container which provides the ability to backup a PostgreSQL database to Minio on demand
Stars: ✭ 18 (-14.29%)
Mutual labels:  s3
Bucket-Flaws
Bucket Flaws ( S3 Bucket Mass Scanner ): A Simple Lightweight Script to Check for Common S3 Bucket Misconfigurations
Stars: ✭ 43 (+104.76%)
Mutual labels:  s3
flask-drive
A simple Flask app to upload and download files off Amazon's S3
Stars: ✭ 23 (+9.52%)
Mutual labels:  s3
mutable
State containers with dirty checking and more
Stars: ✭ 32 (+52.38%)
Mutual labels:  state
great-migration
Copy objects from Rackspace to S3
Stars: ✭ 15 (-28.57%)
Mutual labels:  s3
i3blocks-crypto
💵 View your favorite coins' ticker prices with i3blocks.
Stars: ✭ 30 (+42.86%)
Mutual labels:  module
cachegrand
cachegrand is an open-source fast, scalable and secure Key-Value store, also fully compatible with Redis protocol, designed from the ground up to take advantage of modern hardware vertical scalability, able to provide better performance and a larger cache at lower cost, without losing focus on distributed systems.
Stars: ✭ 87 (+314.29%)
Mutual labels:  s3
go-checksum
Simple tool to calc Golang module checksum of go.mod and module dir.
Stars: ✭ 45 (+114.29%)
Mutual labels:  module
react-drip-form
☕ HoC based React forms state manager, Support for validation and normalization.
Stars: ✭ 66 (+214.29%)
Mutual labels:  state
aws-s3-bucket-purger
A program that will purge any AWS S3 Bucket of objects and versions quickly
Stars: ✭ 18 (-14.29%)
Mutual labels:  s3
poto
multi cloud storage to image gallery + image proxy + file api - 350 LOC.
Stars: ✭ 20 (-4.76%)
Mutual labels:  s3
compose-actors
🤖 Android app built with jetpack 🚀 compose follows new revamped guide to app architecture. Implemented with State, Coroutines ➰, ViewModels, Repository pattern, Light/Dark theme 🌈 MD3, Animations, Draw on canvas, Custom layouts, UI state handling, 🌀 Image loading with coil, Palette 🎨 usage and dynamic theming etc.
Stars: ✭ 80 (+280.95%)
Mutual labels:  state
taiwan-remote-jobs
台灣採用部份遠端工作、完全遠端工作的科技業相關公司清單。
Stars: ✭ 34 (+61.9%)
Mutual labels:  remote
MCM2017
MCM 2017
Stars: ✭ 17 (-19.05%)
Mutual labels:  module
venti
⚛️ Global State for React
Stars: ✭ 16 (-23.81%)
Mutual labels:  state

terraform-remote-state

A Terraform module that configures an s3 bucket for use with Terraform's remote state feature.

Useful for creating a common bucket naming convention and attaching a bucket policy using the specified role.

The way S3 buckets are described in Terraform changed significantly with version 4.0.0 of the AWS provider, which corresponds to the v5.0.0 tag of this module. Be sure to use a previous version of the module (the immediately-prior one is v4.0.2) if you are using an older version of the AWS provider. In general it's a good idea always to reference the module with an explicit ?ref=_tag_ in the URL and commit the .terraform.lock.hcl file created by terraform init alongside your source code.

Inputs

Name Description Type Default Required
application the application that will be using this remote state string - yes
block_public_access ensure bucket access is "Bucket and objects not public" bool true no
multipart_days string 3 no
multipart_delete incomplete multipart upload deletion string true no
role the primary role that will be used to access the tf remote state string - yes
additional_roles additional roles that will be granted access to the remote state list of strings [] no
dynamodb_state_locking if enabled, creates a dynamodb table to be used to store state lock status bool false no
tags tags to apply the created S3 bucket map - yes

Outputs

Name Description
bucket the created bucket
dynamodb_lock_table name of dynamodb lock table, if created

usage example

setup the remote state bucket

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = ">= 4.0.0"
    }
  }
}

module "tf_remote_state" {
  source = "github.com/turnerlabs/terraform-remote-state?ref=v5.1.0"

  role          = "aws-ent-prod-devops"
  application   = "my-test-app"

  tags = {
    team            = "my-team"
    "contact-email" = "[email protected]"
    application     = "my-app"
    environment     = "dev"
    customer        = "my-customer"
  }
}

output "bucket" {
  value = module.tf_remote_state.bucket
}
$ terraform init
$ terraform apply

Apply complete! Resources: 3 added, 0 changed, 0 destroyed.

Outputs:
bucket = tf-state-my-test-app

Now configure your script to use the remote state bucket. Note that you need to be logged in to the specified role in order to apply your scripts.

terraform {
  backend "s3" {
    region  = "us-east-1"
    bucket  = "tf-state-my-test-app"
    key     = "dev.terraform.tfstate"
  }
}
dynamodb state locking

Terraform S3 backend allows you to define a dynamodb table that can be used to store state locking status. To create and use a table set dynamodb_state_locking to true.

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = ">= 4.0.0"
    }
  }
}

module "tf_remote_state" {
  source = "github.com/turnerlabs/terraform-remote-state?ref=v5.1.0"

  role                   = "aws-ent-prod-devops"
  application            = "my-test-app"
  dynamodb_state_locking = "true"

  tags = {
    team            = "my-team"
    "contact-email" = "[email protected]"
    application     = "my-app"
    environment     = "dev"
    customer        = "my-customer"
  }
}

output "bucket" {
  value = module.tf_remote_state.bucket
}

output "bucket" {
  value = module.tf_remote_state.dynamodb_lock_table
}
$ terraform init
$ terraform apply

Apply complete! Resources: 7 added, 0 changed, 0 destroyed.

Outputs:

bucket = "tf-state-my-test-app"
dynamodb_lock_table = "tf-state-lock-my-test-app"

Now configure your script to use the remote state bucket and lock table. Note that you need to be logged in to the specified role in order to apply your scripts.

terraform {
  backend "s3" {
    region         = "us-east-1"
    bucket         = "tf-state-my-test-app"
    key            = "dev.terraform.tfstate"
    dynamodb_table = "tf-state-lock-my-test-app"
  }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].