Skip to content

Commit 11c500d

Browse files
Remove security group from Terraform-managed resources
EC2 instances will use default VPC security group instead of a Terraform-managed one, avoiding destroy conflicts when instances are still running.
1 parent 9a0b9d4 commit 11c500d

File tree

12 files changed

+0
-58
lines changed

12 files changed

+0
-58
lines changed

infra/aws/terraform/modules/orchestration/outputs.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ output "datastream_arn" {
33
description = "State machine ARN for the datastream workflow"
44
}
55

6-
output "ec2_security_group_id" {
7-
value = aws_security_group.datastream_ec2_sg.id
8-
description = "Security group ID for EC2 instances"
9-
}
10-
116
output "lambda_role_arn" {
127
value = aws_iam_role.lambda_role.arn
138
description = "IAM role ARN used by Lambda functions"
Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +0,0 @@
1-
# Security Group for EC2 instances launched by Step Functions
2-
3-
resource "aws_security_group" "datastream_ec2_sg" {
4-
name_prefix = "${var.resource_prefix}_ec2_sg_"
5-
description = "Security group for NRDS datastream EC2 instances"
6-
vpc_id = data.aws_vpc.default.id
7-
8-
egress {
9-
description = "Allow all outbound"
10-
from_port = 0
11-
to_port = 0
12-
protocol = "-1"
13-
cidr_blocks = ["0.0.0.0/0"]
14-
}
15-
16-
tags = {
17-
Name = "${var.resource_prefix}_ec2_sg"
18-
}
19-
20-
lifecycle {
21-
create_before_destroy = true
22-
}
23-
}

infra/aws/terraform/services/nrds-cfe-nom/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ module "schedules" {
4949
state_machine_arn = module.nrds_orchestration.datastream_arn
5050

5151
# EC2 config from orchestration
52-
ec2_security_groups = [module.nrds_orchestration.ec2_security_group_id]
5352
ec2_instance_profile = module.nrds_orchestration.ec2_instance_profile_name
5453

5554
# Model AMI

infra/aws/terraform/services/nrds-cfe-nom/modules/schedules/main.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ variable "state_machine_arn" {
2626
}
2727

2828
# EC2 Configuration
29-
variable "ec2_security_groups" {
30-
type = list(string)
31-
description = "Security group IDs for EC2 instances"
32-
}
33-
3429
variable "ec2_instance_profile" {
3530
type = string
3631
description = "IAM instance profile name for EC2"

infra/aws/terraform/services/nrds-cfe-nom/modules/schedules/schedules.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ locals {
99

1010
# Common CFE_NOM configuration
1111
cfe_nom_ami_id = var.cfe_nom_ami_id
12-
cfe_nom_security_groups = jsonencode(var.ec2_security_groups)
1312
cfe_nom_instance_profile = var.ec2_instance_profile
1413

1514
# Short range forecast config mapping
@@ -166,7 +165,6 @@ resource "aws_scheduler_schedule" "datastream_schedule_short_range_cfe_nom" {
166165
nprocs = each.value.nprocs
167166
ami_id = local.cfe_nom_ami_id
168167
instance_type = each.value.instance_type
169-
security_group_ids = local.cfe_nom_security_groups
170168
instance_profile = local.cfe_nom_instance_profile
171169
volume_size = each.value.volume_size
172170
environment_suffix = var.environment_suffix
@@ -210,7 +208,6 @@ resource "aws_scheduler_schedule" "datastream_schedule_medium_range_cfe_nom" {
210208
nprocs = each.value.nprocs
211209
ami_id = local.cfe_nom_ami_id
212210
instance_type = each.value.instance_type
213-
security_group_ids = local.cfe_nom_security_groups
214211
instance_profile = local.cfe_nom_instance_profile
215212
volume_size = each.value.volume_size
216213
environment_suffix = var.environment_suffix
@@ -254,7 +251,6 @@ resource "aws_scheduler_schedule" "datastream_schedule_AnA_range_cfe_nom" {
254251
nprocs = each.value.nprocs
255252
ami_id = local.cfe_nom_ami_id
256253
instance_type = each.value.instance_type
257-
security_group_ids = local.cfe_nom_security_groups
258254
instance_profile = local.cfe_nom_instance_profile
259255
volume_size = each.value.volume_size
260256
environment_suffix = var.environment_suffix

infra/aws/terraform/services/nrds-cfe-nom/modules/schedules/templates/execution_datastream_cfe_nom_VPU_template.json.tpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"instance_parameters": {
1414
"ImageId": "${ami_id}",
1515
"InstanceType": "${instance_type}",
16-
"SecurityGroupIds": ${security_group_ids},
1716
"IamInstanceProfile": {
1817
"Name": "${instance_profile}"
1918
},

infra/aws/terraform/services/nrds-cfe-nom/outputs.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ output "datastream_arn" {
44
description = "State machine ARN for the datastream workflow"
55
}
66

7-
output "ec2_security_group_id" {
8-
value = module.nrds_orchestration.ec2_security_group_id
9-
description = "Security group ID for EC2 instances"
10-
}
11-
127
output "lambda_role_arn" {
138
value = module.nrds_orchestration.lambda_role_arn
149
description = "IAM role ARN used by Lambda functions"

infra/aws/terraform/services/nrds-routing-only/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ module "schedules" {
4949
state_machine_arn = module.nrds_orchestration.datastream_arn
5050

5151
# EC2 config from orchestration
52-
ec2_security_groups = [module.nrds_orchestration.ec2_security_group_id]
5352
ec2_instance_profile = module.nrds_orchestration.ec2_instance_profile_name
5453

5554
# Model AMI

infra/aws/terraform/services/nrds-routing-only/modules/schedules/main.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ variable "state_machine_arn" {
2323
}
2424

2525
# EC2 Configuration
26-
variable "ec2_security_groups" {
27-
type = list(string)
28-
description = "Security group IDs for EC2 instances"
29-
}
30-
3126
variable "ec2_instance_profile" {
3227
type = string
3328
description = "IAM instance profile name for EC2"

infra/aws/terraform/services/nrds-routing-only/modules/schedules/schedules.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ locals {
1313

1414
# Common Routing-Only configuration
1515
routing_only_ami_id = var.routing_only_ami_id
16-
routing_only_security_groups = jsonencode(var.ec2_security_groups)
1716
routing_only_instance_profile = var.ec2_instance_profile
1817

1918
# Short range forecast config mapping
@@ -75,7 +74,6 @@ resource "aws_scheduler_schedule" "datastream_schedule_short_range_routing_only"
7574
nprocs = each.value.nprocs
7675
ami_id = local.routing_only_ami_id
7776
instance_type = each.value.instance_type
78-
security_group_ids = local.routing_only_security_groups
7977
instance_profile = local.routing_only_instance_profile
8078
volume_size = each.value.volume_size
8179
environment_suffix = var.environment_suffix

0 commit comments

Comments
 (0)