Skip to content

Commit fd3ea0a

Browse files
authored
Merge pull request #35 from techiescamp/develop
Develop
2 parents b6c9d81 + 27dfe4d commit fd3ea0a

File tree

5 files changed

+102
-9
lines changed

5 files changed

+102
-9
lines changed

README.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,8 @@ terraform init \
1111
-backend-config="key=dev/vpc.tfstate" \
1212
-backend-config="bucket=dcube-terraform-state" \
1313
-backend-config="region=us-west-2" \
14-
-backend-config="dynamodb_table=terraform-state-lock"
15-
```
16-
```
17-
18-
terraform destroy \
19-
-backend-config="key=dev/vpc.tfstate" \
20-
-backend-config="bucket=dcube-terraform-state" \
21-
-backend-config="region=us-west-2" \
22-
-backend-config="dynamodb_table=terraform-state-lock"
14+
-backend-config="dynamodb_table=terraform-state-lock" \
15+
-var-file=../../../vars/dev/vpc.tfvars
2316
```
2417

2518
#### VPC Provisioning
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
resource "aws_dynamodb_table" "state_lock_table" {
2+
name = "${var.environment}-${var.application}-dynamodb-table"
3+
billing_mode = var.billing_mode
4+
hash_key = var.hash_key
5+
6+
attribute {
7+
name = var.attribute_name
8+
type = var.attribute_type
9+
}
10+
11+
tags = merge(
12+
{
13+
Name = "${var.environment}-${var.application}-dynamodb-table"
14+
Environment = var.environment,
15+
Owner = var.owner,
16+
CostCenter = var.cost_center,
17+
Application = var.application
18+
},
19+
var.tags
20+
)
21+
}

environments/dev/backend/s3.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
provider "aws" {
2+
region = "us-west-2"
3+
}
4+
5+
resource "aws_s3_bucket" "state_lock_bucket" {
6+
bucket = "${var.environment}-${var.application}-s3-bucket"
7+
8+
tags = merge(
9+
{
10+
Name = "${var.environment}-${var.application}-s3-bucket"
11+
Environment = var.environment,
12+
Owner = var.owner,
13+
CostCenter = var.cost_center,
14+
Application = var.application
15+
},
16+
var.tags
17+
)
18+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
variable "tags" {
2+
default = {}
3+
type = map(string)
4+
description = "Extra tags to attach to the alb-asg resources"
5+
}
6+
7+
variable "region" {
8+
type = string
9+
description = "Region of the alb-asg"
10+
}
11+
12+
variable "billing_mode" {
13+
type = string
14+
description = "Billing mode for dynamodb"
15+
}
16+
17+
variable "hash_key" {
18+
type = string
19+
description = "Hash key name of dynamodb"
20+
}
21+
22+
variable "attribute_name" {
23+
type = string
24+
description = "Attribute name of dynamodb"
25+
}
26+
27+
variable "attribute_type" {
28+
type = string
29+
description = "Attribute type of dynamodb"
30+
}
31+
32+
variable "owner" {
33+
type = string
34+
description = "Name of owner"
35+
}
36+
37+
variable "environment" {
38+
type = string
39+
description = "The environment name for the resources."
40+
}
41+
42+
variable "cost_center" {
43+
type = string
44+
description = "Name of cost-center for the resources."
45+
}
46+
47+
variable "application" {
48+
type = string
49+
description = "Name of the application"
50+
}
51+

vars/dev/backend.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
region = "us-west-2"
2+
billing_mode = "PAY_PER_REQUEST"
3+
hash_key = "LockID"
4+
attribute_name = "LockID"
5+
attribute_type = "S"
6+
7+
owner = "techiescamp"
8+
environment = "dev"
9+
cost_center = "techiescamp-commerce"
10+
application = "java-app"

0 commit comments

Comments
 (0)