blob: 77b85714d5a391fce6732e61a34085262e88edbc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
locals {
name = var.name
}
data "aws_subnet" "ec2" {
filter {
name = "availability-zone"
values = [aws_db_instance.mastodon.availability_zone]
}
filter {
name = "subnet-id"
values = module.vpc.public_subnets
}
}
resource "aws_instance" "mastodon" {
ami = data.aws_ami.debian.id
instance_type = var.ec2_instance_type
subnet_id = data.aws_subnet.ec2.id
key_name = "framework"
vpc_security_group_ids = [aws_security_group.backend.id]
root_block_device {
volume_type = "gp3"
// how to resize partition and file system after resizing ebs volume
// https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html
volume_size = "30"
tags = {
Name = "${local.name}-root"
}
}
tags = {
Name = local.name
}
lifecycle {
ignore_changes = [ami]
}
}
resource "aws_eip" "mastodon" {
instance = aws_instance.mastodon.id
}
|