Files
git/terraform/main.tf
Max 23cf397581 S3 Data Storage (#1)
Using the storage options [here](https://docs.gitea.com/administration/config-cheat-sheet#storage-storage), this commit pushes all packages, avatars, and LFS files to S3.

- Uses AWS S3.
- Frees up storage on EC2 instance, so packages do not eventually steal all of the free space.

Reviewed-on: #1
Co-authored-by: Max <git@maximhutz.me>
Co-committed-by: Max <git@maximhutz.me>
2025-02-19 06:02:46 +00:00

44 lines
1.0 KiB
HCL

# An elastic IP, so if the reverse proxy is modified, the route tables won't.
resource "aws_eip" "public" {
instance = aws_instance.this.id
domain = "vpc"
}
# An instance profile for access via AWS SSM.
resource "aws_iam_instance_profile" "ssm" {
name = "SSMInstanceProfile"
role = "AmazonSSMRoleForInstancesQuickSetup"
}
# The Gitea instance.
resource "aws_instance" "this" {
# ami = data.aws_ami.amazon-linux-2.id
ami = "ami-0adec96dc0cdc7bca"
instance_type = "t4g.nano"
subnet_id = module.vpc.public_subnets[0]
user_data = file("install.sh")
user_data_replace_on_change = true
iam_instance_profile = aws_iam_instance_profile.ssm.name
vpc_security_group_ids = [aws_security_group.public_access.id]
metadata_options {
http_tokens = "required"
}
root_block_device {
volume_type = "gp3"
volume_size = 8
}
tags = {
Name = "Codebase: Gitea"
}
}
resource "aws_ec2_instance_state" "this" {
instance_id = aws_instance.this.id
state = "running"
}