From 24dd35f4bc6a0b8934f09b320f73bc88c6f68f1f Mon Sep 17 00:00:00 2001 From: Ellie Date: Fri, 16 Aug 2024 12:19:54 +0100 Subject: comment out rds.tf to increases tf speed --- terraform/rds.tf | 138 +++++++++++++++++++++++++++---------------------------- 1 file changed, 69 insertions(+), 69 deletions(-) (limited to 'terraform') diff --git a/terraform/rds.tf b/terraform/rds.tf index 88783b7..d1b4959 100644 --- a/terraform/rds.tf +++ b/terraform/rds.tf @@ -1,80 +1,80 @@ -data "aws_availability_zones" "available" {} +# data "aws_availability_zones" "available" {} -module "vpc" { - source = "terraform-aws-modules/vpc/aws" - version = "5.12.1" +# module "vpc" { +# source = "terraform-aws-modules/vpc/aws" +# version = "5.12.1" - name = var.project_name - cidr = "10.0.0.0/16" - azs = data.aws_availability_zones.available.names - public_subnets = ["10.0.4.0/24", "10.0.5.0/24", "10.0.6.0/24"] - enable_dns_hostnames = true - enable_dns_support = true -} +# name = var.project_name +# cidr = "10.0.0.0/16" +# azs = data.aws_availability_zones.available.names +# public_subnets = ["10.0.4.0/24", "10.0.5.0/24", "10.0.6.0/24"] +# enable_dns_hostnames = true +# enable_dns_support = true +# } -resource "aws_db_subnet_group" "Terrific-Totes-sub-gr" { - name = "tt-db-subnet" - subnet_ids = module.vpc.public_subnets +# resource "aws_db_subnet_group" "Terrific-Totes-sub-gr" { +# name = "tt-db-subnet" +# subnet_ids = module.vpc.public_subnets - tags = { - Name = "${var.project_name}" - } -} +# tags = { +# Name = "${var.project_name}" +# } +# } -resource "aws_security_group" "rds" { - name = "${var.project_name}-rds" - vpc_id = module.vpc.vpc_id +# resource "aws_security_group" "rds" { +# name = "${var.project_name}-rds" +# vpc_id = module.vpc.vpc_id - ingress { - from_port = 5432 - to_port = 5432 - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } +# ingress { +# from_port = 5432 +# to_port = 5432 +# protocol = "tcp" +# cidr_blocks = ["0.0.0.0/0"] +# } - egress { - from_port = 5432 - to_port = 5432 - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } +# egress { +# from_port = 5432 +# to_port = 5432 +# protocol = "tcp" +# cidr_blocks = ["0.0.0.0/0"] +# } - tags = { - Name = "${var.project_name}-rds" - } -} +# tags = { +# Name = "${var.project_name}-rds" +# } +# } -resource "aws_db_parameter_group" "Terrific-Totes-param-gr" { - name = "tt-db-param" - family = "postgres14" +# resource "aws_db_parameter_group" "Terrific-Totes-param-gr" { +# name = "tt-db-param" +# family = "postgres14" - parameter { - name = "log_connections" - value = "1" - } -} +# parameter { +# name = "log_connections" +# value = "1" +# } +# } -resource "aws_db_instance" "terrific-totes-rds" { - db_name = var.project_name - instance_class = "db.t3.micro" - allocated_storage = 5 - engine = "postgres" - engine_version = "14.10" - username = "totes" - password = "totes123" - # username = "user credentials for the root user" # we could use .env here - # password = "user password for the root user" # we could use .env here - ### alternatively to providing username nad password we can specify: - # resource "aws_kms_key" "example_key" { - # description = "Example KMS Key" - # } - # within the resource: - # manage_master_user_password = true - # master_user_secret_kms_key_id = aws_kms_key.example.key_id - # } - db_subnet_group_name = aws_db_subnet_group.Terrific-Totes-sub-gr.name - vpc_security_group_ids = [aws_security_group.rds.id] - parameter_group_name = aws_db_parameter_group.Terrific-Totes-param-gr.name - publicly_accessible = false - skip_final_snapshot = true -} +# resource "aws_db_instance" "terrific-totes-rds" { +# db_name = var.project_name +# instance_class = "db.t3.micro" +# allocated_storage = 5 +# engine = "postgres" +# engine_version = "14.10" +# username = "totes" +# password = "totes123" +# # username = "user credentials for the root user" # we could use .env here +# # password = "user password for the root user" # we could use .env here +# ### alternatively to providing username nad password we can specify: +# # resource "aws_kms_key" "example_key" { +# # description = "Example KMS Key" +# # } +# # within the resource: +# # manage_master_user_password = true +# # master_user_secret_kms_key_id = aws_kms_key.example.key_id +# # } +# db_subnet_group_name = aws_db_subnet_group.Terrific-Totes-sub-gr.name +# vpc_security_group_ids = [aws_security_group.rds.id] +# parameter_group_name = aws_db_parameter_group.Terrific-Totes-param-gr.name +# publicly_accessible = false +# skip_final_snapshot = true +# } -- cgit v1.2.3 From 39a33cecb5e19f15bed4a099b02bdba56c80c073 Mon Sep 17 00:00:00 2001 From: HastarTara Date: Fri, 16 Aug 2024 16:05:03 +0100 Subject: infra[tf] update lambda extract doesnt work yet --- terraform/lambda.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'terraform') diff --git a/terraform/lambda.tf b/terraform/lambda.tf index 658b8c8..71ddd11 100644 --- a/terraform/lambda.tf +++ b/terraform/lambda.tf @@ -83,7 +83,7 @@ resource "aws_lambda_function" "load_lambda" { } locals { - layer_dir = "${path.module}/../python" + layer_dir = "${path.module}/.." requirements = "${path.module}/../requirements.txt" layer_zip = "${path.module}/../layer.zip" } @@ -94,9 +94,9 @@ resource "null_resource" "prepare_layer" { } provisioner "local-exec" { command = < Date: Fri, 16 Aug 2024 16:23:56 +0100 Subject: infra(tf): add version constraints for null and archive --- terraform/main.tf | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'terraform') diff --git a/terraform/main.tf b/terraform/main.tf index 3b06701..310a251 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -4,6 +4,14 @@ terraform { source = "hashicorp/aws" version = "~>5.0" } + null = { + source = "hashicorp/null" + version = "~>3.2.2" + } + archive = { + source = "hashicorp/archive" + version = "~>2.5.0" + } } backend "s3" { bucket = "bentley-project-secrets" -- cgit v1.2.3 From 303725f83cf5551b3d165aa02ce81562de488a01 Mon Sep 17 00:00:00 2001 From: Alex Schofield Date: Fri, 16 Aug 2024 16:24:44 +0100 Subject: infra(tf): re-add code that creates layer zip --- terraform/lambda.tf | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'terraform') diff --git a/terraform/lambda.tf b/terraform/lambda.tf index 71ddd11..67fd6eb 100644 --- a/terraform/lambda.tf +++ b/terraform/lambda.tf @@ -83,9 +83,9 @@ resource "aws_lambda_function" "load_lambda" { } locals { - layer_dir = "${path.module}/.." - requirements = "${path.module}/../requirements.txt" - layer_zip = "${path.module}/../layer.zip" + layer_dir = "${path.module}/.." + requirements = "${path.module}/../requirements.txt" + layer_zip = "${path.module}/../layer.zip" } resource "null_resource" "prepare_layer" { @@ -96,23 +96,23 @@ resource "null_resource" "prepare_layer" { command = < Date: Fri, 16 Aug 2024 16:28:04 +0100 Subject: chore(tf): remove dummy username/password sorry hackers! --- terraform/rds.tf | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'terraform') diff --git a/terraform/rds.tf b/terraform/rds.tf index d1b4959..a013fb3 100644 --- a/terraform/rds.tf +++ b/terraform/rds.tf @@ -60,18 +60,8 @@ # allocated_storage = 5 # engine = "postgres" # engine_version = "14.10" -# username = "totes" -# password = "totes123" -# # username = "user credentials for the root user" # we could use .env here -# # password = "user password for the root user" # we could use .env here -# ### alternatively to providing username nad password we can specify: -# # resource "aws_kms_key" "example_key" { -# # description = "Example KMS Key" -# # } -# # within the resource: -# # manage_master_user_password = true -# # master_user_secret_kms_key_id = aws_kms_key.example.key_id -# # } +# username = "" +# password = "" # db_subnet_group_name = aws_db_subnet_group.Terrific-Totes-sub-gr.name # vpc_security_group_ids = [aws_security_group.rds.id] # parameter_group_name = aws_db_parameter_group.Terrific-Totes-param-gr.name -- cgit v1.2.3