File tree Expand file tree Collapse file tree 10 files changed +162
-0
lines changed Expand file tree Collapse file tree 10 files changed +162
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Check
2+ on : [ push, pull_request ]
3+
4+ jobs :
5+ validate :
6+ runs-on : ubuntu-latest
7+ steps :
8+ - uses : actions/checkout@v2
9+
10+ - uses : hashicorp/setup-terraform@v1
11+ with :
12+ terraform_version : 0.14.0
13+
14+ - name : Validate Module
15+ env :
16+ AWS_REGION : ' eu-west-1'
17+ run : |
18+ terraform init -backend=false
19+ terraform validate
20+ terraform fmt -check
21+ - name : Validate Examples
22+ env :
23+ AWS_REGION : ' eu-west-1'
24+ run : |
25+ for example in $(find examples -maxdepth 1 -mindepth 1 -type d); do
26+ cd $example
27+ terraform init -backend=false
28+ terraform validate
29+ terraform fmt -check
30+ cd -
31+ done
Original file line number Diff line number Diff line change 1+ * .tfvars
2+ * .tfstate *
3+ * .lock.hcl *
4+ .terraform /
Original file line number Diff line number Diff line change 1+ repos :
2+ - repo : git://github.com/pre-commit/pre-commit-hooks
3+ rev : v3.4.0
4+ hooks :
5+ - id : check-json
6+ - id : check-merge-conflict
7+ - id : check-yaml
8+ - id : detect-private-key
9+ - id : pretty-format-json
10+ args :
11+ - --autofix
12+ - id : trailing-whitespace
13+
14+ - repo : git://github.com/igorshubovych/markdownlint-cli
15+ rev : v0.26.0
16+ hooks :
17+ - id : markdownlint
18+
19+ - repo : git://github.com/antonbabenko/pre-commit-terraform
20+ rev : v1.45.0
21+ hooks :
22+ - id : terraform_docs
23+ - id : terraform_fmt
Original file line number Diff line number Diff line change 1+ Licensed under the Apache License, Version 2.0 (the "License");
2+ you may not use this file except in compliance with the License.
3+ You may obtain a copy of the License at
4+
5+ http://www.apache.org/licenses/LICENSE-2.0
6+
7+ Unless required by applicable law or agreed to in writing, software
8+ distributed under the License is distributed on an "AS IS" BASIS,
9+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+ See the License for the specific language governing permissions and
11+ limitations under the License.
Original file line number Diff line number Diff line change 1+ # AWS S3 Bootstrap State Module
2+
3+ A Terraform module to create and manage Terraform state on AWS.
4+ Available through the [ Terraform registry] ( https://registry.terraform.io/modules/eriktisme/bootstrap/aws/latest ) .
5+
6+ ## Terraform versions
7+
8+ Terraform 0.13 and above are supported.
9+
10+ ## Usage example
11+
12+ - A simple example is contained in the [ examples directory] ( ./examples/simple ) .
13+
14+ ## Authors
15+
16+ - [ Erik van Dam] ( https://github.com/eriktisme )
17+
18+ ## License
19+
20+ The Apache License, Version 2.0. Please see [ License File] ( LICENSE ) for more information.
Original file line number Diff line number Diff line change 1+ module "bootstrap" {
2+ source = " ../../"
3+
4+ project_alias = " simple"
5+ region = " eu-west-1"
6+ }
Original file line number Diff line number Diff line change 1+ module "terraform_state_bucket" {
2+ source = " eriktisme/s3-bucket/aws"
3+ version = " 0.1.0"
4+
5+ bucket = " ${ var . project_alias } -${ var . bucket_purpose } -${ var . region } "
6+
7+ tags = merge (var. tags )
8+ }
9+
10+ resource "aws_dynamodb_table" "terraform_state_lock" {
11+ hash_key = " LockID"
12+ name = var. table_name
13+ read_capacity = 2
14+ write_capacity = 2
15+
16+ server_side_encryption {
17+ enabled = true
18+ }
19+
20+ attribute {
21+ name = " LockID"
22+ type = " S"
23+ }
24+
25+ tags = merge (var. tags )
26+ }
Original file line number Diff line number Diff line change 1+ output "dynamodb_table" {
2+ description = " The name of the DynamoDB table created for the Terraform state."
3+ value = aws_dynamodb_table. terraform_state_lock . id
4+ }
Original file line number Diff line number Diff line change 1+ variable "table_name" {
2+ description = " The table name for the Terraform state lock."
3+ default = " terraform-state-lock"
4+ type = string
5+ }
6+
7+ variable "project_alias" {
8+ description = " The AWS account alias."
9+ type = string
10+ }
11+
12+ variable "bucket_purpose" {
13+ description = " The identification of the bucket's purpose."
14+ default = " terraform-state"
15+ type = string
16+ }
17+
18+ variable "region" {
19+ description = " The AWS region the account will be bootstrapped in."
20+ type = string
21+ }
22+
23+ variable "tags" {
24+ description = " A mapping of tags to assign to the table."
25+ type = map (string )
26+ default = {}
27+ }
Original file line number Diff line number Diff line change 1+ terraform {
2+ required_version = " >= 0.13"
3+
4+ required_providers {
5+ aws = {
6+ source = " hashicorp/aws"
7+ version = " ~> 3.23.0"
8+ }
9+ }
10+ }
You can’t perform that action at this time.
0 commit comments