Skip to content

Commit

Permalink
fix(env-vars): fix missing env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
Cali93 committed Jul 7, 2023
2 parents daa7b0c + fd2e9b5 commit 6449357
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 26 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ jobs:
TF_VAR_hcaptcha_secret: ${{ secrets.HCAPTCHA_SECRET }}
TF_VAR_direct_url: ${{ secrets.DIRECT_URL }}
TF_VAR_database_url: ${{ secrets.DATABASE_URL }}
TF_VAR_redis_host: ${{ secrets.REDIS_HOST }}
TF_VAR_redis_port: ${{ secrets.REDIS_PORT }}
TF_VAR_redis_password: ${{ secrets.REDIS_PASSWORD }}
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand Down
15 changes: 15 additions & 0 deletions terraform/ecs/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,18 @@ variable "supabase_jwt_secret" {
type = string
sensitive = true
}

variable "redis_host" {
type = string
sensitive = true
}

variable "redis_port" {
type = string
sensitive = true
}

variable "redis_password" {
type = string
sensitive = true
}
17 changes: 5 additions & 12 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,8 @@ module "redis_global" {

redis_name = "cloud-auth-redis"
app_name = "${terraform.workspace}_redis_${local.app_name}"
vpc_id = module.eu-central-1.vpc_id
node_type = var.redis_node_type
global = true

private_subnet_ids = module.eu-central-1.private_subnets

allowed_ingress_cidr_blocks = tolist(toset([
module.us-east-1.cidr_block,
module.eu-central-1.cidr_block,
module.ap-southeast-1.cidr_block
]))
}
vpc_id = module.vpc.vpc_id
node_type = "cache.t2.micro"

allowed_ingress_cidr_blocks = module.vpc.private_subnets
}
30 changes: 16 additions & 14 deletions terraform/redis/main.tf
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
resource "aws_elasticache_cluster" "cache" {
cluster_id = replace("${var.app_name}-${var.redis_name}", "_", "-")
engine = "redis"
node_type = var.node_type
num_cache_nodes = 1
parameter_group_name = "default.redis6.x"
engine_version = "6.x"
port = 6379
subnet_group_name = aws_elasticache_subnet_group.private_subnets.name
security_group_ids = [
aws_security_group.service_security_group.id
]
}

resource "aws_elasticache_subnet_group" "private_subnets" {
name = replace("${var.app_name}-${var.redis_name}-private-subnet-group", "_", "-")
subnet_ids = data.aws_subnets.private_subnets.ids
Expand All @@ -36,3 +22,19 @@ resource "aws_security_group" "service_security_group" {
cidr_blocks = ["0.0.0.0/0"] # Allowing traffic out to all IP addresses
}
}

resource "aws_elasticache_cluster" "cache" {
cluster_id = replace("${var.app_name}-${var.redis_name}", "_", "-")
engine = "redis"
node_type = var.node_type
num_cache_nodes = 1
parameter_group_name = "default.redis6.x"
engine_version = "6.x"
port = 6379
subnet_group_name = aws_elasticache_subnet_group.private_subnets.name
security_group_ids = [
aws_security_group.service_security_group.id
]
}


2 changes: 2 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ variable "redis_host" {
type = string
sensitive = true
}

variable "redis_port" {
type = string
sensitive = true
}

variable "redis_password" {
type = string
sensitive = true
Expand Down

0 comments on commit 6449357

Please sign in to comment.