-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
82 additions
and
79 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module "eks" { | ||
source = "terraform-aws-modules/eks/aws" | ||
version = "~> 19.0" | ||
|
||
cluster_name = "secure-auth-cluster" | ||
cluster_version = "1.27" | ||
|
||
vpc_id = module.vpc.vpc_id | ||
subnet_ids = module.vpc.private_subnets | ||
|
||
eks_managed_node_groups = { | ||
default = { | ||
min_size = 1 | ||
max_size = 3 | ||
desired_size = 2 | ||
|
||
instance_types = ["t3.medium"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// IAM policies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// TODO: Set up CloudTrail & CloudWatch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Security group for RDS | ||
resource "aws_security_group" "rds" { | ||
name = "secure-auth-rds-sg" | ||
description = "Security group for RDS instance" | ||
vpc_id = module.vpc.vpc_id | ||
|
||
ingress { | ||
from_port = 5432 | ||
to_port = 5432 | ||
protocol = "tcp" | ||
security_groups = [module.eks.cluster_security_group_id] | ||
} | ||
} | ||
|
||
// RDS subnet group | ||
resource "aws_db_subnet_group" "rds" { | ||
name = "secure-auth-rds-subnet-group" | ||
subnet_ids = module.vpc.private_subnets | ||
} | ||
|
||
// RDS instance | ||
resource "aws_db_instance" "postgres" { | ||
identifier = "secure-auth-db" | ||
engine = "postgres" | ||
engine_version = "14.7" | ||
instance_class = "db.t3.micro" // Adjust based on your needs | ||
allocated_storage = 20 | ||
|
||
db_name = "secureauthdb" | ||
// Update to use AWS Secrets Manager | ||
username = var.db_username | ||
password = var.db_password | ||
|
||
db_subnet_group_name = aws_db_subnet_group.rds.name | ||
vpc_security_group_ids = [aws_security_group.rds.id] | ||
|
||
skip_final_snapshot = true // Set to false for production | ||
|
||
# Disable public access | ||
publicly_accessible = false | ||
|
||
tags = { | ||
Name = "secure-auth-postgres-rds" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module "vpc" { | ||
source = "terraform-aws-modules/vpc/aws" | ||
|
||
name = "secure-auth-vpc" | ||
cidr = "10.0.0.0/16" | ||
|
||
azs = ["${var.region}a", "${var.region}b"] | ||
private_subnets = ["10.0.1.0/24", "10.0.2.0/24"] | ||
public_subnets = ["10.0.101.0/24", "10.0.102.0/24"] | ||
|
||
enable_nat_gateway = true | ||
} | ||
|
||
// subnets, NAT Gateways, Security Groups, etc. |