Skip to content

Commit

Permalink
Updated terraform so that we could destroy old environments.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesiarmes committed Mar 19, 2024
1 parent 5cd1525 commit 4e77d76
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 131 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
.terraform/
*.tfstate
*.tfstate.backup

# Ignore local environment files.
.env.*
*.env
5 changes: 0 additions & 5 deletions accounts/non-prod/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@ terraform {
version = ">= 4.22"
source = "hashicorp/aws"
}

template = {
version = ">= 2.2"
source = "hashicorp/template"
}
}
}
5 changes: 0 additions & 5 deletions accounts/production/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@ terraform {
version = ">= 4.22"
source = "hashicorp/aws"
}

template = {
version = ">= 2.2"
source = "hashicorp/template"
}
}
}
5 changes: 0 additions & 5 deletions accounts/sandbox/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@ terraform {
version = ">= 4.22"
source = "hashicorp/aws"
}

template = {
version = ">= 2.2"
source = "hashicorp/template"
}
}
}
5 changes: 0 additions & 5 deletions environments/development/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@ terraform {
version = ">= 4.22"
source = "hashicorp/aws"
}

template = {
version = ">= 2.2"
source = "hashicorp/template"
}
}
}
132 changes: 53 additions & 79 deletions environments/production/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions environments/production/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ module "hosting" {
database_max_capacity = 3
database_min_capacity = 2

force_delete = true

# Snapshot created in order to enable encryption at rest.
database_starting_snapshot = "r911-production-encrypt"

Expand Down Expand Up @@ -74,6 +76,8 @@ module "ci_cd" {
image_repository_name = module.hosting.image_repository.name
logging_bucket = module.hosting.logging_bucket.id
web_security_group_id = module.hosting.web_security_group.id

force_delete = true
}

module "data_lake" {
Expand All @@ -84,6 +88,8 @@ module "data_lake" {
environment = local.environment
logging_bucket = module.hosting.logging_bucket.id
admin_user_group = "Admin"

force_delete = true
}

module "data_warehouse" {
Expand All @@ -106,6 +112,8 @@ module "etl" {
vpc_id = module.networking.vpc_id
logging_bucket = module.hosting.logging_bucket.id

force_delete = true

warehouse_endpoint = module.data_warehouse.cluster.endpoint[0]
warehouse_credentials_secret = module.data_warehouse.crednetials_secret.name
data_lake_bucket = module.data_lake.bucket.bucket
Expand Down
5 changes: 0 additions & 5 deletions environments/production/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@ terraform {
version = ">= 4.22"
source = "hashicorp/aws"
}

template = {
version = ">= 2.2"
source = "hashicorp/template"
}
}
}
5 changes: 0 additions & 5 deletions modules/backend/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@ terraform {
version = ">= 4.22"
source = "hashicorp/aws"
}

template = {
version = ">= 2.2"
source = "hashicorp/template"
}
}
}
5 changes: 0 additions & 5 deletions modules/data_lake/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@ terraform {
version = ">= 4.22"
source = "hashicorp/aws"
}

template = {
version = ">= 2.2"
source = "hashicorp/template"
}
}
}
5 changes: 0 additions & 5 deletions modules/data_warehouse/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,5 @@ terraform {
version = ">= 3.1"
source = "hashicorp/null"
}

template = {
version = ">= 2.2"
source = "hashicorp/template"
}
}
}
5 changes: 0 additions & 5 deletions modules/etl/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@ terraform {
version = ">= 4.22"
source = "hashicorp/aws"
}

template = {
version = ">= 2.2"
source = "hashicorp/template"
}
}
}
1 change: 0 additions & 1 deletion modules/networking/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ resource "aws_internet_gateway" "internet_gateway" {

resource "aws_eip" "nat_gateway_ip" {
count = var.single_nat_gateway ? 1 : var.availability_zones
vpc = true

tags = {
Name = "${local.prefix}-nat-${aws_subnet.public[count.index].availability_zone}"
Expand Down
5 changes: 0 additions & 5 deletions modules/rails_hosting/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,5 @@ terraform {
version = ">= 3.3"
source = "hashicorp/random"
}

template = {
version = ">= 2.2"
source = "hashicorp/template"
}
}
}
6 changes: 5 additions & 1 deletion modules/rails_hosting/waf.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ resource "aws_wafv2_web_acl" "web" {
name = "AWSManagedRulesCommonRuleSet"
vendor_name = "AWS"

excluded_rule {
rule_action_override {
action_to_use {
count {}
}

name = "SizeRestrictions_BODY"
}
}
Expand Down

0 comments on commit 4e77d76

Please sign in to comment.