Skip to content
Closed
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
8 changes: 7 additions & 1 deletion infrastructure/aws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ No modules.
| Name | Type |
|------|------|
| [aws_db_instance.branch_rds](https://registry.terraform.io/providers/hashicorp/aws/6.14.1/docs/resources/db_instance) | resource |
| [aws_db_subnet_group.branch_rds_subnet_group](https://registry.terraform.io/providers/hashicorp/aws/6.14.1/docs/resources/db_subnet_group) | resource |
| [aws_s3_bucket.c4c_demo](https://registry.terraform.io/providers/hashicorp/aws/6.14.1/docs/resources/s3_bucket) | resource |
| [aws_subnets.default](https://registry.terraform.io/providers/hashicorp/aws/6.14.1/docs/data-sources/subnets) | data source |
| [infisical_secrets.rds_folder](https://registry.terraform.io/providers/infisical/infisical/latest/docs/data-sources/secrets) | data source |

## Inputs
Expand All @@ -35,5 +38,8 @@ No modules.

## Outputs

No outputs.
| Name | Description |
|------|-------------|
| <a name="output_rds_endpoint"></a> [rds\_endpoint](#output\_rds\_endpoint) | RDS instance endpoint |
| <a name="output_rds_port"></a> [rds\_port](#output\_rds\_port) | RDS instance port |
<!-- END_TF_DOCS -->
51 changes: 43 additions & 8 deletions infrastructure/aws/main.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,45 @@
# VPC and networking for RDS
data "aws_subnets" "default" {
filter {
name = "default-for-az"
values = ["true"]
}
}

# DB subnet group
resource "aws_db_subnet_group" "branch_rds_subnet_group" {
name = "branch-rds-subnet-group"
subnet_ids = data.aws_subnets.default.ids

tags = {
Name = "branch-rds-subnet-group"
}
}

resource "aws_db_instance" "branch_rds" {
allocated_storage = 10
db_name = "branch_rds"
engine = "postgres"
engine_version = "17.6"
instance_class = "db.t3.micro"
username = data.infisical_secrets.rds_folder.secrets["username"].value
password = data.infisical_secrets.rds_folder.secrets["password"].value
skip_final_snapshot = true
allocated_storage = 10
db_name = "branch_rds"
engine = "postgres"
engine_version = "17.6"
instance_class = "db.t3.micro"
username = data.infisical_secrets.rds_folder.secrets["username"].value
password = data.infisical_secrets.rds_folder.secrets["password"].value
skip_final_snapshot = true
publicly_accessible = true
db_subnet_group_name = aws_db_subnet_group.branch_rds_subnet_group.name

tags = {
Name = "branch-rds-instance"
}
}

# Output the RDS endpoint for easy access
output "rds_endpoint" {
value = aws_db_instance.branch_rds.endpoint
description = "RDS instance endpoint"
}

output "rds_port" {
value = aws_db_instance.branch_rds.port
description = "RDS instance port"
}
3 changes: 3 additions & 0 deletions infrastructure/aws/s3.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resource "aws_s3_bucket" "c4c_demo" {
bucket_prefix = "c4c-demo-"
}