Skip to content

Commit

Permalink
Merge pull request #17 from QuiNovas/develop
Browse files Browse the repository at this point in the history
Version update and resource update
  • Loading branch information
yesh-naik-12 authored Feb 16, 2022
2 parents ba8811b + be67c23 commit 70687dd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
37 changes: 24 additions & 13 deletions s3-bucket.tf
Original file line number Diff line number Diff line change
@@ -1,30 +1,41 @@
resource "aws_s3_bucket" "config" {
acl = "log-delivery-write"
bucket = local.config_name

lifecycle {
prevent_destroy = true
}

tags = var.tags
}

lifecycle_rule {
id = "log"
enabled = true
resource "aws_s3_bucket_logging" "config" {
bucket = aws_s3_bucket.config.id

transition {
days = var.transition_to_glacier
storage_class = "GLACIER"
}
target_bucket = var.log_bucket
target_prefix = "s3/${local.config_name}/"
}

resource "aws_s3_bucket_acl" "config" {
bucket = aws_s3_bucket.config.id
acl = "log-delivery-write"
}

resource "aws_s3_bucket_lifecycle_configuration" "config" {
bucket = aws_s3_bucket.config.bucket
rule {
id = "log"

expiration {
days = var.expiration
}
}

logging {
target_bucket = var.log_bucket
target_prefix = "s3/${local.config_name}/"
status = "Enabled"

transition {
days = var.transition_to_glacier
storage_class = "GLACIER"
}
}
tags = var.tags
}

data "aws_iam_policy_document" "config" {
Expand Down
1 change: 1 addition & 0 deletions versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.0.0"
}
}
}

0 comments on commit 70687dd

Please sign in to comment.