now we've got a working upload process

main
Nick Dumas 2 years ago
parent fe7e635c12
commit c6dad9669a

@ -1,14 +1,31 @@
resource "aws_s3_bucket" "blog" { resource "aws_s3_bucket" "blog" {
bucket = "ndumas-blog" bucket = "blog.ndumas.com"
force_destroy = true force_destroy = true
} }
resource "aws_s3_bucket_acl" "example" { resource "aws_s3_bucket_acl" "blog_acl" {
bucket = aws_s3_bucket.blog.id bucket = aws_s3_bucket.blog.id
acl = "public-read" acl = "public-read"
} }
resource "aws_s3_bucket_website_configuration" "blog_site" {
bucket = aws_s3_bucket.blog.id
index_document {
suffix = "index.html"
}
}
resource "aws_s3_bucket_cors_configuration" "blog_cors" {
bucket = aws_s3_bucket.blog.id
cors_rule {
allowed_headers = ["*"]
allowed_methods = ["GET"]
allowed_origins = ["https://blog.ndumas.com", "http://blog.ndumas.com"]
max_age_seconds = 3000
}
}
resource "aws_iam_user" "blog_uploader" { resource "aws_iam_user" "blog_uploader" {
name = "blog-uploader" name = "blog-uploader"
} }
@ -36,8 +53,8 @@ resource "aws_iam_policy" "blog_bucket_policy" {
"s3:DeleteObject" "s3:DeleteObject"
], ],
"Resource" : [ "Resource" : [
"arn:aws:s3:::*/*", "arn:aws:s3:::*/*",
"arn:aws:s3:::ndumas-blog" "arn:aws:s3:::blog.ndumas.com"
] ]
} }
] ]

Loading…
Cancel
Save