Coder Social home page Coder Social logo

yuchenno7 / terraform-aws-backend Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dnxlabs/terraform-aws-backend

0.0 0.0 0.0 39 KB

This terraform module implements what is described in the Terraform S3 Backend.

Home Page: https://modules.dnx.one

License: Apache License 2.0

Makefile 5.35% HCL 94.65%

terraform-aws-backend's Introduction

terraform-aws-backend

Lint Status LICENSE

This terraform module implements what is described in the Terraform S3 Backend documentation.

S3 Encryption is enabled and Public Access policies used to ensure security.

This module is expected to be deployed to a 'master' AWS account so that you can start using remote state as soon as possible. As this module creates the remote state backend, its statefile needs to be commited to git as it cannot be stored remotely. No sensetive information should be present in this file.

It is also expected that you check the statefile for this module into git to avoid the chicken and egg problem.

The following resources will be created:

  • Encrypted S3 Bucket - Used to store Terraform state files
    • This bucket
      • Block public acls
      • Block public policy
      • Ignore public acls
      • Restrict public buckets
  • AWS DynamoDB Table - Used for workspace locking
  • Identity and Access Management (IAM) - Backend All - Role that Allows access to all Terraform workspaces
  • Identity and Acesss Management (IAM) - Backend restricted - These roles are limited to their specific workspace through the use of S3 resource permissions

Resources

Name Resource Description
<prefix>-terraform-backend S3 Bucket Used to store Terraform state files
terraform-lock DynamoDB Table Used for workspace locking
terraform-backend IAM Role Role created that has access to all terraform workspaces
terraform-backend-<workspace> IAM Role Role created that only has access to the specified workspace

Requirements

Name Version
terraform >= 0.13.0

Providers

Name Version
aws >= 4.0.0

Inputs

Name Description Type Default Required
assume_policy A map that allows you to specify additional AWS principles that will be added to the backend roles assume role policy map(string) {} no
bucket_prefix A prefix applied to the S3 bucket created to ensure a unique name. string n/a yes
bucket_sse_algorithm Encryption algorithm to use on the S3 bucket. Currently only AES256 is supported string "AES256" no
workspaces A list of terraform workspaces that IAM Roles/Policy will be created for list(string) n/a yes

Outputs

Name Description
dynamo_lock_table n/a
iam_roles n/a
state_bucket_arn n/a

Assume Role Policy

The assume_role_policy by default will be set to the current account ID. This is primarily so can you can use the roles while your 'identity' account is under construction. Once your identity account is available you should specify the required assume_role_policy and the default will be removed.

Due to terraform lookup() only supporting string returns this cant be a list and needs to be specified as a string with principles seperated by commas in the event multiple entries are required.

  assume_policy = {
   prod    = "arn:aws:iam::xxxxxxxxxxxx:root,arn:aws:iam::yyyyyyyyyyyy:root"
   nonprod = "arn:aws:iam::xxxxxxxxxxxx:root,arn:aws:iam::yyyyyyyyyyyy:root"
   sandpit = "arn:aws:iam::xxxxxxxxxxxx:root,arn:aws:iam::yyyyyyyyyyyy:root"
  }

Author

Module managed by DNX Solutions.

License

Apache 2 Licensed. See LICENSE for full details.

terraform-aws-backend's People

Contributors

arthurbdiniz avatar adenot avatar caiovfernandes avatar hugojosefson avatar lzrocha avatar mdbdba avatar mvsnogueira-dnx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.