Skip to content

Commit

Permalink
feat: Support bucket encryption for existing cloudtrail
Browse files Browse the repository at this point in the history
Signed-off-by: Lei Jin <lei.jin@lacework.net>
  • Loading branch information
leijin-lw committed Sep 5, 2024
1 parent e5ecd21 commit 0116256
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions integration/aws_generation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ func TestGenerationAwsNoninteractive(t *testing.T) {
aws.WithCloudtrailUseExistingTrail(true),
aws.WithCloudtrailName(cloudtrailName),
aws.WithExistingCloudtrailBucketArn(s3BucketArn),
aws.WithBucketEncryptionEnabled(true),
aws.WithBucketSSEKeyArn(kmsArn),
aws.WithCloudtrailUseExistingSNSTopic(true),
aws.WithExistingSnsTopicArn(snsTopicArn),
aws.WithSnsTopicEncryptionEnabled(true),
Expand Down
14 changes: 7 additions & 7 deletions lwgenerate/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -1058,14 +1058,14 @@ func createCloudtrail(args *GenerateAwsTfConfigurationArgs) (*hclwrite.Block, er
if args.BucketName != "" {
attributes["bucket_name"] = args.BucketName
}
if args.BucketEncryptionEnabledSet {
if args.BucketEncryptionEnabled {
if args.BucketSseKeyArn != "" {
attributes["bucket_sse_key_arn"] = args.BucketSseKeyArn
}
} else {
attributes["bucket_encryption_enabled"] = false
}
if args.BucketEncryptionEnabledSet {
if args.BucketEncryptionEnabled {
if args.BucketSseKeyArn != "" {
attributes["bucket_sse_key_arn"] = args.BucketSseKeyArn
}
} else {
attributes["bucket_encryption_enabled"] = false
}
}
if args.S3BucketNotification {
Expand Down

0 comments on commit 0116256

Please sign in to comment.