1
0
Fork 0

setup website as own file

This commit is contained in:
Lance Vick 2023-03-31 01:38:53 -07:00
parent 19887efd22
commit ad8535ae2d
Signed by: lrvick
GPG Key ID: 8E47A1EC35A1551D
2 changed files with 13 additions and 14 deletions

View File

@ -9,17 +9,3 @@ variable "out_dir" {
resource "random_id" "suffix" {
byte_length = 8
}
resource "digitalocean_spaces_bucket" "website" {
name = "website-${random_id.suffix.hex}"
region = var.region
}
resource "digitalocean_spaces_bucket_object" "website" {
for_each = fileset("${var.out_dir}/website", "*")
region = var.region
bucket = digitalocean_spaces_bucket.website.name
source = "${var.out_dir}/website/${each.value}"
key = each.value
etag = filemd5("${var.out_dir}/website/${each.value}")
}

13
infra/main/website.tf Normal file
View File

@ -0,0 +1,13 @@
resource "digitalocean_spaces_bucket" "website" {
name = "website-${random_id.suffix.hex}"
region = var.region
}
resource "digitalocean_spaces_bucket_object" "website" {
for_each = fileset("${var.out_dir}/website", "*")
region = var.region
bucket = digitalocean_spaces_bucket.website.name
source = "${var.out_dir}/website/${each.value}"
key = each.value
etag = filemd5("${var.out_dir}/website/${each.value}")
}