Skip to content

Commit 4d029ee

Browse files
committed
initial commmit
0 parents  commit 4d029ee

File tree

17 files changed

+291
-0
lines changed

17 files changed

+291
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Local .terraform directories
2+
**/.terraform/*

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Street 54
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Terraform remote backend module for aws
2+
Terraform module which initialize remote tf-backend back-storage using DynamoDB and S3
3+
4+
## Examples
5+
- [Complete Example](https://github.com/tf-mod/terraform-aws-tfbackend/tree/master/examples/complete)
6+
- [Simple Example](https://github.com/tf-mod/terraform-aws-tfbackend/tree/master/examples/simple)

examples/complete/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Full example of terraform remote backend module for aws
2+
3+
## Usage
4+
Please see the `init-tf-backend.tf` file for detail code.
5+
6+
```
7+
module "tfbackend" {
8+
source = "tf-mod/tfbackend/aws"
9+
version = "1.0.0"
10+
11+
aws_account_id = "${var.aws_account_id}"
12+
bucket_name = "${var.bucket_name}"
13+
dynamodb_table = "${var.dynamodb_table}"
14+
dynamodb_read_capacity = "10"
15+
dynamodb_write_capacity = "10"
16+
}
17+
```
18+
19+
And if you want change the parameters of this example with your own environment, you can edit terraform file (`init-tf-backend.tf`) directly or update the variables in `terraform.tfvars` file.
20+
21+
```
22+
aws_account_id = "859086152267"
23+
aws_region = "ap-northeast-2"
24+
aws_profile = "my"
25+
bucket_name = "my-terraform-state"
26+
dynamodb_table = "my-terraform-lock"
27+
dynamodb_read_capacity = "10"
28+
dynamodb_write_capacity = "10"
29+
```
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Complete example
2+
3+
module "tfbackend" {
4+
source = "tf-mod/tfbackend/aws"
5+
version = "1.0.0"
6+
7+
aws_account_id = "${var.aws_account_id}"
8+
bucket_name = "${var.bucket_name}"
9+
dynamodb_table = "${var.dynamodb_table}"
10+
dynamodb_read_capacity = "10"
11+
dynamodb_write_capacity = "10"
12+
}

examples/complete/provider.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
terraform {
2+
required_version = ">= 0.12.0"
3+
}
4+
5+
provider "aws" {
6+
region = "${var.aws_region}"
7+
profile = "${var.aws_profile}"
8+
allowed_account_ids = ["${var.aws_account_id}"]
9+
version = ">= 1.15.0"
10+
}

examples/complete/terraform.tfvars

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
aws_account_id = "859086152267"
2+
aws_region = "ap-northeast-2"
3+
aws_profile = "my"
4+
bucket_name = "my-terraform-state"
5+
dynamodb_table = "my-terraform-lock"
6+
dynamodb_read_capacity = "10"
7+
dynamodb_write_capacity = "10"

examples/complete/variables.tf

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
variable "aws_account_id" {
2+
description = "The aws account id for the tf backend creation (e.g. 857026751867)"
3+
}
4+
5+
variable "aws_region" {
6+
default = "us-east-1"
7+
}
8+
9+
variable "aws_profile" {
10+
default = "default"
11+
}
12+
13+
variable "bucket_name" {
14+
description = "The s3 bucket name for terraform state. it can be same on account-level (e.g. 'my-terraform-state')"
15+
}
16+
17+
variable "dynamodb_table" {
18+
description = "DynamoDB table name to store lock object for terraform operation"
19+
}
20+
21+
variable "dynamodb_read_capacity" {
22+
description = "The read_capacity value for the DynamoDB table to store lock object"
23+
default = 5
24+
}
25+
26+
variable "dynamodb_write_capacity" {
27+
description = "The write_capacity value for the DynamoDB table to store lock object"
28+
default = 5
29+
}

examples/simple/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Easy way of terraform remote backend module for aws
2+
3+
## Usage
4+
Please see the `init-tf-backend.tf` file for detail code.
5+
6+
```
7+
module "tfbackend" {
8+
source = "tf-mod/tfbackend/aws"
9+
version = "1.0.0"
10+
11+
aws_account_id = "${var.aws_account_id}"
12+
bucket_name = "${var.bucket_name}"
13+
dynamodb_table = "${var.dynamodb_table}"
14+
}
15+
```
16+
17+
And if you want change the parameters of this example with your own environment, you can edit terraform file (`init-tf-backend.tf`) directly or update the variables in `terraform.tfvars` file.
18+
19+
20+
```
21+
aws_account_id = "857086752267"
22+
aws_region = "ap-northeast-2"
23+
aws_profile = "my"
24+
bucket_name = "my-terraform-state"
25+
dynamodb_table = "my-terraform-lock"
26+
```

examples/simple/init-tf-backend.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Simple example
2+
3+
module "tfbackend" {
4+
source = "tf-mod/tfbackend/aws"
5+
version = "1.0.0"
6+
7+
aws_account_id = "${var.aws_account_id}"
8+
bucket_name = "${var.bucket_name}"
9+
dynamodb_table = "${var.dynamodb_table}"
10+
}

0 commit comments

Comments
 (0)