Skip to content

Instantly share code, notes, and snippets.

@gungoren
Created January 17, 2023 15:20
Show Gist options
  • Save gungoren/ec4d6c5e866113f289153805b600f45a to your computer and use it in GitHub Desktop.
Save gungoren/ec4d6c5e866113f289153805b600f45a to your computer and use it in GitHub Desktop.
resource "aws_s3_object" "index" {
bucket = module.origin_bucket.s3_bucket_id
key = "index.html"
source = "${path.module}/files/index.html"
content_type = "text/html"
etag = filemd5("${path.module}/files/index.html")
}
resource "aws_s3_object" "global" {
bucket = module.origin_bucket.s3_bucket_id
key = "flag.png"
source = "${path.module}/files/flag.png"
content_type = "image/png"
etag = filemd5("${path.module}/files/flag.png")
}
locals {
countries = toset(["CA", "ES", "IT", "JP", "TR", "US"])
}
resource "aws_s3_object" "countries_flag" {
for_each = local.countries
bucket = module.origin_bucket.s3_bucket_id
key = "${each.key}/flag.png"
source = "${path.module}/files/flag_${each.key}.png"
content_type = "image/png"
etag = filemd5("${path.module}/files/flag_${each.key}.png")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment