Skip to content

Commit b0837ef

Browse files
authored
Merge pull request #332 from meysam81/meysam/elasticip-for-dev-desktop
feat: add elasticip for production dev-desktop ✨
2 parents 5b11770 + 428ed0b commit b0837ef

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

terraform/dev-desktops/aws-region/instances.tf

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
// Instances
22

3+
resource "aws_eip" "dev_desktop" {
4+
for_each = var.instances
5+
6+
vpc = true
7+
8+
tags = {
9+
Name = each.key
10+
}
11+
}
12+
13+
resource "aws_eip_association" "dev_desktop" {
14+
for_each = var.instances
15+
16+
instance_id = aws_instance.instance[each.key].id
17+
allocation_id = aws_eip.dev_desktop[each.key].id
18+
}
19+
320
resource "aws_instance" "instance" {
421
for_each = var.instances
522

@@ -140,7 +157,7 @@ resource "aws_route53_record" "ipv4" {
140157
zone_id = data.aws_route53_zone.rust_lang_org.id
141158
name = "${each.key}.infra.rust-lang.org"
142159
type = "A"
143-
records = [aws_instance.instance[each.key].public_ip]
160+
records = [aws_eip.dev_desktop[each.key].public_ip]
144161
ttl = 60
145162
}
146163

0 commit comments

Comments
 (0)