jdormit-infra/prod/git-jeremydormitzer-com/terraform/main.tf
2021-01-25 17:56:15 -05:00

42 lines
1.1 KiB
HCL

provider "digitalocean" {
token = var.do_token
spaces_access_id = var.spaces_access_id
spaces_secret_key = var.spaces_secret_key
}
resource "digitalocean_droplet" "git_jeremydormitzer_com" {
name = "git.jeremydormitzer.com"
image = "41695378"
region = "nyc3"
size = "s-1vcpu-1gb"
backups = true
tags = ["terraform"]
}
module "packer_droplet" {
source = "../../../terraform-modules/packer_droplet"
name = "gitea"
do_token = var.do_token
spaces_access_id = var.spaces_access_id
spaces_secret_key = var.spaces_secret_key
}
resource "digitalocean_volume" "gitea_volume" {
name = "gitea-volume"
description = "The volume to hold Gitea repositories and data"
region = "nyc1"
size = 20
initial_filesystem_label = "gitea-volume"
initial_filesystem_type = "ext4"
tags = ["terraform"]
lifecycle {
prevent_destroy = true
}
}
resource "digitalocean_volume_attachment" "gitea" {
droplet_id = module.packer_droplet.droplet_id
volume_id = digitalocean_volume.gitea_volume.id
}