Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DS-2050 Performance and Regression SG #77

Merged
merged 5 commits into from
Jan 18, 2024
Merged
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
1 change: 1 addition & 0 deletions build/automation/var/profile/live.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

PROJECT_IMAGE_TAG :=
ENV := live
ENVIRONMENT := live
SERVICE_PREFIX := $(PROJECT_ID)-$(ENV)
AWS_ROLE_PIPELINE = jenkins_assume_role
# ==============================================================================
Expand Down
6 changes: 6 additions & 0 deletions build/automation/var/profile/nonprod.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,10 @@ TF_VAR_splunk_firehose_role := dos_cw_w_events_firehose_access_role

LAMBDA_VERSIONS_TO_RETAIN = 5


# Adding Performance and Regression SG as the legacy SG [live-lk8s-nonprod-core-dos-db-rds-postgres-sg]
# with access to all DB is being deprecated
# As a result adding additional SG to the Lambda used in nonprod
TF_VAR_db_security_group_name = uec-core-dos-pipeline-datastore-hk-sg
TF_VAR_db_performance_security_group_name = uec-core-dos-performance-datastore-hk-sg
TF_VAR_db_regression_security_group_name = uec-core-dos-regression-datastore-hk-sg
1 change: 1 addition & 0 deletions build/automation/var/profile/put.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

PROJECT_IMAGE_TAG :=
ENV := put
ENVIRONMENT := put
SERVICE_PREFIX := $(PROJECT_ID)-$(ENV)
AWS_ROLE_PIPELINE = jenkins_assume_role
# ==============================================================================
Expand Down
8 changes: 8 additions & 0 deletions infrastructure/stacks/security-groups/data.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
data "aws_security_group" "datastore" {
name = var.db_security_group_name
}

data "aws_security_group" "datastore_performance" {
name = var.db_performance_security_group_name
}

data "aws_security_group" "datastore_regression" {
name = var.db_regression_security_group_name
}
38 changes: 37 additions & 1 deletion infrastructure/stacks/security-groups/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ resource "aws_security_group" "hk_lambda_sg" {
protocol = "tcp"
security_groups = [data.aws_security_group.datastore.id]
}

egress {
description = "Core DoS Performance DB Access"
from_port = 5432
to_port = 5432
protocol = "tcp"
security_groups = [data.aws_security_group.datastore_performance.id]
}

egress {
description = "Core DoS Regression DB Access"
from_port = 5432
to_port = 5432
protocol = "tcp"
security_groups = [data.aws_security_group.datastore_regression.id]
}
egress {
description = "AWS API Outbound Access"
from_port = 443
Expand All @@ -26,5 +42,25 @@ resource "aws_security_group_rule" "db_sg_ingress" {
protocol = "tcp"
security_group_id = data.aws_security_group.datastore.id
source_security_group_id = aws_security_group.hk_lambda_sg.id
description = "A rule to allow incoming connections from hk lambda to RDS Security Group"
description = "A rule to allow incoming connections from hk lambda to Datastore Security Group"
}

resource "aws_security_group_rule" "db_perf_sg_ingress" {
type = "ingress"
from_port = 5432
to_port = 5432
protocol = "tcp"
security_group_id = data.aws_security_group.datastore_performance.id
source_security_group_id = aws_security_group.hk_lambda_sg.id
description = "A rule to allow incoming connections from hk lambda to Performance Datastore Security Group"
}

resource "aws_security_group_rule" "db_regression_sg_ingress" {
type = "ingress"
from_port = 5432
to_port = 5432
protocol = "tcp"
security_group_id = data.aws_security_group.datastore_regression.id
source_security_group_id = aws_security_group.hk_lambda_sg.id
description = "A rule to allow incoming connections from hk lambda to Regression Datastore Security Group"
}
8 changes: 8 additions & 0 deletions infrastructure/stacks/security-groups/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@ variable "vpc_terraform_state_key" {
variable "db_security_group_name" {
description = "Identifier of security group attached to datastore"
}

variable "db_regression_security_group_name" {
description = "Identifier of security group attached to datastore for regression"
}

variable "db_performance_security_group_name" {
description = "Identifier of security group attached to datastore for performance"
}
Loading