Skip to content

Commit

Permalink
Merge pull request #17 from nekochans/feature/issue12
Browse files Browse the repository at this point in the history
LGTM画像になる前の一時的な画像を扱う為のS3バケットを作成
  • Loading branch information
keitakn authored Apr 5, 2021
2 parents a6cee19 + 023e94e commit 965ffd6
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 0 deletions.
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

0 comments on commit 965ffd6

Please sign in to comment.