File tree Expand file tree Collapse file tree 5 files changed +17
-38
lines changed Expand file tree Collapse file tree 5 files changed +17
-38
lines changed Original file line number Diff line number Diff line change @@ -98,14 +98,12 @@ module "comet_rds" {
98
98
count = var. enable_rds ? 1 : 0
99
99
environment = var. environment
100
100
101
- ec2_enabled = var. enable_ec2
102
- eks_enabled = var. enable_eks
103
-
104
101
availability_zones = var. enable_vpc ? module. comet_vpc [0 ]. azs : var. availability_zones
105
102
vpc_id = var. enable_vpc ? module. comet_vpc [0 ]. vpc_id : var. comet_vpc_id
106
103
rds_private_subnets = var. enable_vpc ? module. comet_vpc [0 ]. private_subnets : var. comet_private_subnets
107
- rds_allow_ec2_sg = var. enable_ec2 ? module. comet_ec2 [0 ]. comet_ec2_sg_id : null
108
- rds_allow_eks_sg = var. enable_eks ? module. comet_eks [0 ]. nodegroup_sg_id : null
104
+ rds_allow_from_sg = var. enable_ec2 ? module. comet_ec2 [0 ]. comet_ec2_sg_id : (
105
+ var. enable_eks ? module. comet_eks [0 ]. nodegroup_sg_id : (
106
+ var. rds_allow_from_sg ))
109
107
rds_engine = var. rds_engine
110
108
rds_engine_version = var. rds_engine_version
111
109
rds_instance_type = var. rds_instance_type
Original file line number Diff line number Diff line change @@ -107,19 +107,9 @@ resource "aws_security_group" "mysql_sg" {
107
107
}
108
108
109
109
resource "aws_vpc_security_group_ingress_rule" "mysql_port_inbound_ec2" {
110
- count = var. ec2_enabled ? 1 : 0
111
110
security_group_id = aws_security_group. mysql_sg . id
112
111
from_port = local. mysql_port
113
112
to_port = local. mysql_port
114
113
ip_protocol = " tcp"
115
- referenced_security_group_id = var. rds_allow_ec2_sg
116
- }
117
-
118
- resource "aws_vpc_security_group_ingress_rule" "mysql_port_inbound_eks" {
119
- count = var. eks_enabled ? 1 : 0
120
- security_group_id = aws_security_group. mysql_sg . id
121
- from_port = local. mysql_port
122
- to_port = local. mysql_port
123
- ip_protocol = " tcp"
124
- referenced_security_group_id = var. rds_allow_eks_sg
114
+ referenced_security_group_id = var. rds_allow_from_sg
125
115
}
Original file line number Diff line number Diff line change 1
1
variable "environment" {
2
2
description = " Deployment environment, i.e. dev/stage/prod, etc"
3
3
type = string
4
- default = " dev"
5
4
}
6
5
7
6
variable "availability_zones" {
@@ -19,13 +18,8 @@ variable "rds_private_subnets" {
19
18
type = list (string )
20
19
}
21
20
22
- variable "rds_allow_ec2_sg" {
23
- description = " Security group associated with EC2 compute, if provisioned"
24
- type = string
25
- }
26
-
27
- variable "rds_allow_eks_sg" {
28
- description = " Security group associated with EKS compute, if provisioned"
21
+ variable "rds_allow_from_sg" {
22
+ description = " Security group from which to allow connections to RDS, for use when provisioning in existing VPC"
29
23
type = string
30
24
}
31
25
@@ -77,16 +71,4 @@ variable "rds_database_name" {
77
71
variable "rds_root_password" {
78
72
description = " Root password for RDS database"
79
73
type = string
80
- }
81
-
82
- variable "ec2_enabled" {
83
- description = " Indicates if EC2 compute has been provisioned for Comet"
84
- type = bool
85
- default = null
86
- }
87
-
88
- variable "eks_enabled" {
89
- description = " Indicates if EKS compute has been provisioned for Comet"
90
- type = bool
91
- default = null
92
74
}
Original file line number Diff line number Diff line change @@ -9,15 +9,18 @@ enable_s3 = false
9
9
region = " us-east-1"
10
10
environment = " prod"
11
11
12
- # if not using enable_vpc to provision a VPC for the Comet resources, set the variables below to specify the existing VPC
12
+ # if not using comet_vpc to provision a VPC for the Comet resources, set the variables below to specify the existing VPC
13
13
comet_vpc_id = " vpc-012345abcdefghijkl"
14
14
availability_zones = [" us-east-1a" , " us-east-1b" , " us-east-1c" ]
15
15
comet_public_subnets = [" subnet-012345abcdefghijkl" , " subnet-012345abcdefghijkl" , " subnet-012345abcdefghijkl" ]
16
16
comet_private_subnets = [" subnet-012345abcdefghijkl" , " subnet-012345abcdefghijkl" , " subnet-012345abcdefghijkl" ]
17
17
18
- # if provisioning ElastiCache in existing VPC, set the variable below to specify an SG that connections will be allowed from
18
+ # if provisioning comet_elasticache in existing VPC, set the variable below to specify an SG that connections will be allowed from
19
19
elasticache_allow_from_sg = " sg-012345abcdefghijkl"
20
20
21
+ # if provisioning comet_rds in existing VPC, set the variable below to specify an SG that connections will be allowed from
22
+ rds_allow_from_sg = " sg-012345abcdefghijkl"
23
+
21
24
s3_bucket_name = " comet-use2-bucket"
22
25
rds_root_password = " CHANGE-ME"
23
26
ssl_certificate_arn = " "
Original file line number Diff line number Diff line change @@ -230,6 +230,12 @@ variable "elasticache_num_cache_nodes" {
230
230
}
231
231
232
232
# comet_rds
233
+ variable "rds_allow_from_sg" {
234
+ description = " Security group from which to allow connections to RDS, for use when provisioning in existing VPC"
235
+ type = string
236
+ default = null
237
+ }
238
+
233
239
variable "rds_engine" {
234
240
description = " Engine type for RDS database"
235
241
type = string
You can’t perform that action at this time.
0 commit comments