Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LGTM画像になる前の一時的な画像を扱う為のS3バケットを作成 #17

Merged
merged 1 commit into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions modules/aws/images/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
resource "aws_s3_bucket" "upload_images_bucket" {
bucket = var.upload_images_bucket_name
acl = "private"

force_destroy = true

versioning {
enabled = true
}

lifecycle_rule {
enabled = true
// 失効した削除マーカーまたは不完全なマルチパートアップロードを削除する
abort_incomplete_multipart_upload_days = 7

// 古いバージョンは30日で削除
noncurrent_version_expiration {
days = 30
}
}
}

resource "aws_s3_bucket" "lgtm_images_bucket" {
bucket = var.lgtm_images_bucket_name
acl = "private"
Expand Down
4 changes: 4 additions & 0 deletions modules/aws/images/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
output "upload_images_bucket_name" {
value = aws_s3_bucket.upload_images_bucket.bucket
}

output "lgtm_images_bucket_name" {
value = aws_s3_bucket.lgtm_images_bucket.bucket
}
4 changes: 4 additions & 0 deletions modules/aws/images/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
variable "upload_images_bucket_name" {
type = string
}

variable "lgtm_images_bucket_name" {
type = string
}
Expand Down
1 change: 1 addition & 0 deletions providers/aws/environments/prod/11-images/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ module "images" {
lgtm_images_cdn_domain = local.lgtm_images_cdn_domain
lgtm_images_cdn_acm_arn = local.lgtm_images_cdn_acm_arn
main_host_zone = data.aws_route53_zone.main_host_zone.zone_id
upload_images_bucket_name = local.upload_images_bucket_name
}
4 changes: 4 additions & 0 deletions providers/aws/environments/prod/11-images/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
output "upload_images_bucket_name" {
value = module.images.upload_images_bucket_name
}

output "lgtm_images_bucket_name" {
value = module.images.lgtm_images_bucket_name
}
1 change: 1 addition & 0 deletions providers/aws/environments/prod/11-images/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ locals {
lgtm_images_cdn_domain = "${local.lgtm_images_cdn_sub_domain}.${var.main_domain_name}"
lgtm_images_cdn_acm_arn = data.terraform_remote_state.acm.outputs.us_east_1_sub_domain_acm_arn
main_host_zone = data.aws_route53_zone.main_host_zone
upload_images_bucket_name = "${local.env}-${local.name}-upload-images"
}

variable "main_domain_name" {
Expand Down