Skip to content

Commit

Permalink
Stop using deprecated resources (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjagiello authored Dec 16, 2023
1 parent e52ee69 commit fe1c1ec
Showing 1 changed file with 50 additions and 15 deletions.
65 changes: 50 additions & 15 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ resource "aws_codepipeline" "codepipeline" {

configuration = {
S3Bucket = aws_s3_bucket.source_bucket.bucket
S3ObjectKey = aws_s3_bucket_object.source_object.key
S3ObjectKey = aws_s3_object.source_object.key
}
}
}
Expand All @@ -61,36 +61,71 @@ resource "aws_codepipeline" "codepipeline" {
resource "aws_s3_bucket" "artifact_bucket" {
# tfsec:ignore:AWS002
bucket = "notifications-test-artifact-bucket"
}

resource "aws_s3_bucket_ownership_controls" "artifact_bucket" {
bucket = aws_s3_bucket.artifact_bucket.id
rule {
object_ownership = "BucketOwnerPreferred"
}
}

resource "aws_s3_bucket_acl" "artifact_bucket" {
depends_on = [aws_s3_bucket_ownership_controls.artifact_bucket]

bucket = aws_s3_bucket.artifact_bucket.id
acl = "private"
}

server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
resource "aws_s3_bucket_server_side_encryption_configuration" "artifact_bucket" {
bucket = aws_s3_bucket.artifact_bucket.id

rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}

resource "aws_s3_bucket" "source_bucket" {
# tfsec:ignore:AWS002
bucket = "notifications-test-source-bucket"
acl = "private"
}

resource "aws_s3_bucket_ownership_controls" "source_bucket" {
bucket = aws_s3_bucket.source_bucket.id

versioning {
enabled = true
rule {
object_ownership = "BucketOwnerPreferred"
}
}

server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
resource "aws_s3_bucket_acl" "source_bucket" {
depends_on = [aws_s3_bucket_ownership_controls.source_bucket]

bucket = aws_s3_bucket.source_bucket.id
acl = "private"
}

resource "aws_s3_bucket_server_side_encryption_configuration" "source_bucket" {
bucket = aws_s3_bucket.source_bucket.id

rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}

resource "aws_s3_bucket_object" "source_object" {
resource "aws_s3_bucket_versioning" "source_bucket" {
bucket = aws_s3_bucket.source_bucket.id

versioning_configuration {
status = "Enabled"
}
}

resource "aws_s3_object" "source_object" {
bucket = aws_s3_bucket.source_bucket.bucket
key = "test"
content = "test"
Expand Down

0 comments on commit fe1c1ec

Please sign in to comment.