New version of alpha named atlas ready for provisioning

This commit is contained in:
shockrah 2022-10-29 15:50:40 -07:00
parent 369a5dbfa1
commit 3ef52017c1
3 changed files with 98 additions and 0 deletions

View File

@ -1,11 +1,13 @@
# Alpha is our primary server that we use for bots which basically
# serve services that I personally run
######################### SSH KEY ##############################################
resource "aws_key_pair" "alpha_ssh" {
key_name = var.alpha_ssh_key_name
public_key = file(var.alpha_public_key_path)
}
######################### files.leftcoast.space VOLUME #########################
resource "aws_ebs_volume" "photo_gallery_volume" {
availability_zone = var.athens_availability_zone
size = 35
@ -16,6 +18,7 @@ resource "aws_ebs_volume" "photo_gallery_volume" {
}
}
######################### clips.shockrah.xyz VOLUME ############################
resource "aws_ebs_volume" "id" {
availability_zone = "us-west-1b"
size = 35
@ -25,6 +28,7 @@ resource "aws_ebs_volume" "id" {
}
}
######################### INSTANCE CONFIGURATION ###############################
resource "aws_instance" "alpha" {
ami = var.alpha_ami_id
instance_type = var.alpha_instance_type
@ -44,9 +48,12 @@ resource "aws_instance" "alpha" {
}
######################### ATTACHMENT FOR files.leftcoast.space #################
resource "aws_volume_attachment" "photo_gallery_attach" {
# hdp is for hard drive photos in this case
device_name = "/dev/sdp"
volume_id = aws_ebs_volume.photo_gallery_volume.id
instance_id = aws_instance.alpha.id
}

66
infra/atlas.tf Normal file
View File

@ -0,0 +1,66 @@
# This is the continuation of the old alpha host but with much cleaner code
# and less manual infra setup involved. Key differences are that block storage
# is now completely kept in this module instead of yolo'd out like before.
######################### SSH KEY ##############################################
resource "aws_key_pair" "atlas_ssh" {
key_name = var.atlas_ssh_key_name
public_key = file(var.atlas_public_key_path)
}
######################### files.leftcoast.space VOLUME #########################
resource "aws_ebs_volume" "files-leftcoast-space" {
availability_zone = var.athens_availability_zone
size = 30
tags = {
Name = "files.leftcoast.space-ebs"
Description = "Volume is to be used entirely for Photos/Video"
}
}
######################### clips.shockrah.xyz VOLUME ############################
resource "aws_ebs_volume" "clips-shockrah-xyz" {
availability_zone = var.athens_availability_zone
size = 30
tags = {
Name = "clips.shockrah.xyz-ebs"
Description = "Used for the clippable instance"
}
}
######################### ATTACHMENT FOR files.leftcoast.space #################
resource "aws_volume_attachment" "files-leftcoast-space" {
device_name = "/dev/sdf"
volume_id = aws_ebs_volume.files-leftcoast-space.id
instance_id = aws_instance.atlas.id
}
######################### ATTACHMENT FOR clips.shockrah.xyz ####################
resource "aws_volume_attachment" "clips-shockrah-xyz" {
device_name = "/dev/sdg"
volume_id = aws_ebs_volume.clips-shockrah-xyz.id
instance_id = aws_instance.atlas.id
}
######################### INSTANCE CONFIGURATION ###############################
resource "aws_instance" "atlas" {
ami = var.atlas_ami_id
instance_type = var.atlas_instance_type
key_name = var.atlas_ssh_key_name
private_ip = "10.0.1.20"
vpc_security_group_ids = [
aws_security_group.general_web_req.id,
aws_security_group.remote_ssh_rec.id
]
subnet_id = aws_subnet.crete_subnet.id
tags = {
Name = "Atlas Host"
Description = "Simple Docker host for some personal stuff"
}
}

View File

@ -43,6 +43,31 @@ variable "alpha_ami_id" {
type = string
}
######################### Alpha variables ######################################
variable "atlas_ssh_key_name" {
description = "Atlas ssh keyname"
type = string
sensitive = true
}
variable "atlas_public_key_path" {
description = "Atlas' key filepath on local disk"
type = string
sensitive = true
}
variable "atlas_instance_type" {
description = "Atlas instance type larger size for docker"
type = string
sensitive = true
}
variable "atlas_ami_id" {
description = "AMI type for the docker host"
type = string
}
######################### Beta variables
variable "beta_ssh_key_name" {
description = "SSH Key name for static web host"