Skip to content

Commit 596cf4a

Browse files
authored
Merge pull request #8 from CodeSparta/jrickard-devkit-route53
jrickard devkit route53
2 parents 16f8738 + 3f1b2d7 commit 596cf4a

6 files changed

Lines changed: 57 additions & 59 deletions

File tree

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ module "registry-node" {
6363
depends_on = [module.route-53]
6464

6565
vpc_id = module.vpc.vpc_id
66-
master_sg_ids = [module.security-groups.master_sg_id]
66+
registry_sg_ids = [module.security-groups.registry_sg_id]
6767
cluster_name = var.cluster_name
6868
cluster_domain = var.cluster_domain
6969
aws_region = var.aws_region

registry-node/registry-node.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ resource "aws_instance" "registry-node" {
3333
user_data = "{\"ignition\":{\"config\":{},\"security\":{\"tls\":{}},\"timeouts\":{},\"version\":\"2.2.0\"},\"networkd\":{},\"passwd\":{\"users\":[{\"name\":\"core\",\"sshAuthorizedKeys\":[\"${var.ssh_public_key}}\"]}]},\"storage\":{},\"systemd\":{}}"
3434

3535
root_block_device { volume_size = var.registry_volume }
36-
security_groups = var.master_sg_ids
36+
security_groups = var.registry_sg_ids
3737
associate_public_ip_address = true
3838

3939
tags = merge(

registry-node/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ variable "ssh_public_key" {
1616
variable "rhcos_ami" {default = ""}
1717
variable "registry_type" {default = "m5.xlarge"}
1818
variable "registry_volume" {default = ""}
19-
variable "master_sg_ids" {default = "" }
19+
variable "registry_sg_ids" {default = "" }
2020
variable "route53_private_zone_id" {default = ""}
21-
variable "cluster_domain" { default = "" }
21+
variable "cluster_domain" { default = "" }

route-53/private-dns.tf

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -13,57 +13,3 @@ resource "aws_route53_zone" "private_zone" {
1313
)
1414
)
1515
}
16-
17-
resource "aws_route53_record" "api-int" {
18-
name = "api-int.${aws_route53_zone.private_zone.name}"
19-
type = "CNAME"
20-
zone_id = aws_route53_zone.private_zone.zone_id
21-
records = ["replaceme"]
22-
ttl = 300
23-
}
24-
25-
resource "aws_route53_record" "api" {
26-
name = "api.${aws_route53_zone.private_zone.name}"
27-
type = "CNAME"
28-
zone_id = aws_route53_zone.private_zone.zone_id
29-
records = ["replaceme"]
30-
ttl = 300
31-
}
32-
33-
resource "aws_route53_record" "etcd_srv" {
34-
allow_overwrite = "true"
35-
name = "_etcd-server-ssl._tcp"
36-
type = "SRV"
37-
zone_id = aws_route53_zone.private_zone.zone_id
38-
records = [
39-
"0 10 2380 etcd-0.${var.cluster_name}.${var.cluster_domain}",
40-
"0 10 2380 etcd-1.${var.cluster_name}.${var.cluster_domain}",
41-
"0 10 2380 etcd-2.${var.cluster_name}.${var.cluster_domain}"
42-
]
43-
ttl = 300
44-
}
45-
46-
resource "aws_route53_record" "wildcard-apps" {
47-
name = "*.apps.${aws_route53_zone.private_zone.name}"
48-
type = "CNAME"
49-
zone_id = aws_route53_zone.private_zone.zone_id
50-
records = ["replaceme"]
51-
ttl = 300
52-
}
53-
54-
resource "aws_route53_record" "etcd-entries" {
55-
count = 3
56-
zone_id = aws_route53_zone.private_zone.id
57-
name = "etcd-${count.index}.${aws_route53_zone.private_zone.name}"
58-
type = "A"
59-
ttl = "300"
60-
records = ["192.168.1.100"]
61-
}
62-
63-
resource "aws_route53_record" "registry" {
64-
zone_id = aws_route53_zone.private_zone.id
65-
name = "registry.${aws_route53_zone.private_zone.name}"
66-
type = "A"
67-
ttl = "300"
68-
records = ["192.168.1.100"]
69-
}

security-groups/outputs.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@ output "master_sg_id" {
44

55
output "worker_sg_id" {
66
value = aws_security_group.worker-sg.id
7-
}
7+
}
8+
9+
output "registry_sg_id" {
10+
value = aws_security_group.registry-sg.id
11+
}

security-groups/registry-sg.tf

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
resource "aws_security_group" "registry-sg" {
2+
name = "${var.cluster_name}-registry-sg"
3+
vpc_id = data.aws_vpc.cluster_vpc.id
4+
5+
tags = merge(
6+
var.default_tags,
7+
map(
8+
"Name", "${var.cluster_name}-registry-sg",
9+
"kubernetes.io/cluster/${var.cluster_name}", "owned"
10+
)
11+
)
12+
}
13+
14+
resource "aws_security_group_rule" "registry_ingress_8080" {
15+
security_group_id = aws_security_group.registry-sg.id
16+
type = "ingress"
17+
cidr_blocks = [var.cidr_blocks]
18+
protocol = "tcp"
19+
from_port = 8080
20+
to_port = 8080
21+
}
22+
23+
resource "aws_security_group_rule" "registry_ingress_5000" {
24+
security_group_id = aws_security_group.registry-sg.id
25+
type = "ingress"
26+
cidr_blocks = [var.cidr_blocks]
27+
protocol = "tcp"
28+
from_port = 5000
29+
to_port = 5000
30+
}
31+
32+
resource "aws_security_group_rule" "registry_ingress_22" {
33+
security_group_id = aws_security_group.registry-sg.id
34+
type = "ingress"
35+
cidr_blocks = [var.cidr_blocks]
36+
protocol = "tcp"
37+
from_port = 22
38+
to_port = 22
39+
}
40+
41+
resource "aws_security_group_rule" "registry_egress_all" {
42+
type = "egress"
43+
security_group_id = aws_security_group.registry-sg.id
44+
protocol = "all"
45+
cidr_blocks = ["0.0.0.0/0"]
46+
from_port = 0
47+
to_port = 0
48+
}

0 commit comments

Comments
 (0)