Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,8 @@ terraform init \
-backend-config="key=dev/vpc.tfstate" \
-backend-config="bucket=dcube-terraform-state" \
-backend-config="region=us-west-2" \
-backend-config="dynamodb_table=terraform-state-lock"
```
```

terraform destroy \
-backend-config="key=dev/vpc.tfstate" \
-backend-config="bucket=dcube-terraform-state" \
-backend-config="region=us-west-2" \
-backend-config="dynamodb_table=terraform-state-lock"
-backend-config="dynamodb_table=terraform-state-lock" \
-var-file=../../../vars/dev/vpc.tfvars
```

#### VPC Provisioning
Expand Down
21 changes: 21 additions & 0 deletions environments/dev/backend/dynamodb.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
resource "aws_dynamodb_table" "state_lock_table" {
name = "${var.environment}-${var.application}-dynamodb-table"
billing_mode = var.billing_mode
hash_key = var.hash_key

attribute {
name = var.attribute_name
type = var.attribute_type
}

tags = merge(
{
Name = "${var.environment}-${var.application}-dynamodb-table"
Environment = var.environment,
Owner = var.owner,
CostCenter = var.cost_center,
Application = var.application
},
var.tags
)
}
18 changes: 18 additions & 0 deletions environments/dev/backend/s3.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
provider "aws" {
region = "us-west-2"
}

resource "aws_s3_bucket" "state_lock_bucket" {
bucket = "${var.environment}-${var.application}-s3-bucket"

tags = merge(
{
Name = "${var.environment}-${var.application}-s3-bucket"
Environment = var.environment,
Owner = var.owner,
CostCenter = var.cost_center,
Application = var.application
},
var.tags
)
}
51 changes: 51 additions & 0 deletions environments/dev/backend/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
variable "tags" {
default = {}
type = map(string)
description = "Extra tags to attach to the alb-asg resources"
}

variable "region" {
type = string
description = "Region of the alb-asg"
}

variable "billing_mode" {
type = string
description = "Billing mode for dynamodb"
}

variable "hash_key" {
type = string
description = "Hash key name of dynamodb"
}

variable "attribute_name" {
type = string
description = "Attribute name of dynamodb"
}

variable "attribute_type" {
type = string
description = "Attribute type of dynamodb"
}

variable "owner" {
type = string
description = "Name of owner"
}

variable "environment" {
type = string
description = "The environment name for the resources."
}

variable "cost_center" {
type = string
description = "Name of cost-center for the resources."
}

variable "application" {
type = string
description = "Name of the application"
}

10 changes: 10 additions & 0 deletions vars/dev/backend.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
region = "us-west-2"
billing_mode = "PAY_PER_REQUEST"
hash_key = "LockID"
attribute_name = "LockID"
attribute_type = "S"

owner = "techiescamp"
environment = "dev"
cost_center = "techiescamp-commerce"
application = "java-app"