|
| 1 | +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types |
| 2 | +locals { |
| 3 | + mime_types = { |
| 4 | + aac = "audio/aac" |
| 5 | + abw = "application/x-abiword" |
| 6 | + apng = "image/apng" |
| 7 | + arc = "application/x-freearc" |
| 8 | + avif = "image/avif" |
| 9 | + avi = "video/x-msvideo" |
| 10 | + azw = "application/vnd.amazon.ebook" |
| 11 | + bin = "application/octet-stream" |
| 12 | + bmp = "image/bmp" |
| 13 | + bz = "application/x-bzip" |
| 14 | + bz2 = "application/x-bzip2" |
| 15 | + cda = "application/x-cdf" |
| 16 | + csh = "application/x-csh" |
| 17 | + css = "text/css" |
| 18 | + csv = "text/csv" |
| 19 | + doc = "application/msword" |
| 20 | + docx = "application/vnd.openxmlformats-officedocument.wordprocessingml.document" |
| 21 | + eot = "application/vnd.ms-fontobject" |
| 22 | + epub = "application/epub+zip" |
| 23 | + gz = "application/gzip" |
| 24 | + gif = "image/gif" |
| 25 | + htm = "text/html" |
| 26 | + html = "text/html" |
| 27 | + ico = "image/vnd.microsoft.icon" |
| 28 | + ics = "text/calendar" |
| 29 | + jar = "application/java-archive" |
| 30 | + jpeg = "image/jpeg" |
| 31 | + jpg = "image/jpeg" |
| 32 | + js = "application/javascript" |
| 33 | + json = "application/json" |
| 34 | + jsonld = "application/ld+json" |
| 35 | + map = "application/json" |
| 36 | + mid = "audio/midi, audio/x-midi" |
| 37 | + midi = "audio/midi, audio/x-midi" |
| 38 | + mjs = "text/javascript" |
| 39 | + mp3 = "audio/mpeg" |
| 40 | + mp4 = "video/mp4" |
| 41 | + mpeg = "video/mpeg" |
| 42 | + mpkg = "application/vnd.apple.installer+xml" |
| 43 | + odp = "application/vnd.oasis.opendocument.presentation" |
| 44 | + ods = "application/vnd.oasis.opendocument.spreadsheet" |
| 45 | + odt = "application/vnd.oasis.opendocument.text" |
| 46 | + oga = "audio/ogg" |
| 47 | + ogv = "video/ogg" |
| 48 | + ogx = "application/ogg" |
| 49 | + opus = "audio/opus" |
| 50 | + otf = "font/otf" |
| 51 | + png = "image/png" |
| 52 | + pdf = "application/pdf" |
| 53 | + php = "application/x-httpd-php" |
| 54 | + ppt = "application/vnd.ms-powerpoint" |
| 55 | + pptx = "application/vnd.openxmlformats-officedocument.presentationml.presentation" |
| 56 | + rar = "application/vnd.rar" |
| 57 | + rtf = "application/rtf" |
| 58 | + sh = "application/x-sh" |
| 59 | + svg = "image/svg+xml" |
| 60 | + tar = "application/x-tar" |
| 61 | + tif = "image/tiff" |
| 62 | + tiff = "image/tiff" |
| 63 | + ts = "video/mp2t" |
| 64 | + ttf = "font/ttf" |
| 65 | + txt = "text/plain" |
| 66 | + vsd = "application/vnd.visio" |
| 67 | + wav = "audio/wav" |
| 68 | + weba = "audio/webm" |
| 69 | + webm = "video/webm" |
| 70 | + webp = "image/webp" |
| 71 | + woff = "font/woff" |
| 72 | + woff2 = "font/woff2" |
| 73 | + xhtml = "application/xhtml+xml" |
| 74 | + xls = "application/vnd.ms-excel" |
| 75 | + xlsx = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" |
| 76 | + xml = "application/xml" |
| 77 | + xul = "application/vnd.mozilla.xul+xml" |
| 78 | + zip = "application/zip" |
| 79 | + } |
| 80 | +} |
| 81 | + |
| 82 | +resource "aws_s3_object" "website_source" { |
| 83 | + for_each = (var.website_source_folder != null) ? fileset(var.website_source_folder, "**") : [] |
| 84 | + bucket = local.bucket_name |
| 85 | + key = each.value |
| 86 | + source = "${var.website_source_folder}/${each.value}" |
| 87 | + content_type = lookup(local.mime_types, split(".", each.value)[length(split(".", each.value)) - 1], "text/html") |
| 88 | + etag = filemd5("${var.website_source_folder}/${each.value}") |
| 89 | +} |
0 commit comments