forked from public/stack
set mimetypes on web files
This commit is contained in:
parent
dc8c74238e
commit
b75b1f1138
|
@ -1,6 +1,19 @@
|
|||
locals {
|
||||
content_types = {
|
||||
css = "text/css"
|
||||
html = "text/html"
|
||||
js = "application/javascript"
|
||||
json = "application/json"
|
||||
txt = "text/plain"
|
||||
png = "image/png"
|
||||
svg = "image/svg+xml"
|
||||
}
|
||||
}
|
||||
|
||||
resource "digitalocean_spaces_bucket" "website" {
|
||||
name = "website-${random_id.suffix.hex}"
|
||||
region = var.region
|
||||
acl = "public-read"
|
||||
}
|
||||
|
||||
resource "digitalocean_spaces_bucket_object" "website" {
|
||||
|
@ -10,7 +23,9 @@ resource "digitalocean_spaces_bucket_object" "website" {
|
|||
source = "${var.out_dir}/website/${each.value}"
|
||||
key = each.value
|
||||
etag = filemd5("${var.out_dir}/website/${each.value}")
|
||||
content_type = lookup(local.content_types, element(split(".", each.value), length(split(".", each.value)) - 1), "text/plain")
|
||||
acl = "public-read"
|
||||
content_encoding = "utf-8"
|
||||
}
|
||||
|
||||
resource "tls_private_key" "website" {
|
||||
|
|
Loading…
Reference in New Issue