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

Allow user to define cloudtrail name #1657

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 3 additions & 1 deletion lwgenerate/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -1050,9 +1050,11 @@ func createCloudtrail(args *GenerateAwsTfConfigurationArgs) (*hclwrite.Block, er
attributes["consolidated_trail"] = true
}
// S3 Bucket attributes
if args.CloudtrailName != "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why adding this? Will the following if args.CloudtrailUseExistingTrail work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we want the user to define the new cloudtrail name. Existing go-sdk is using "lacework-cloudtrail" as default new cloudtrail name and we cannot change it.

There is a bug happen when user failed to delete the old "lacework-cloudtrail" and the new cloudtrail has to be a different name

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the code below (line 1054) attributes["cloudtrail_name"] = args.CloudtrailName using the passed in args.CloudtrailName?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get your point. I'll remove the line. attributes["cloudtrail_name"] should not depends onargs.CloudtrailUseExistingTrail

attributes["cloudtrail_name"] = args.CloudtrailName
}
if args.CloudtrailUseExistingTrail {
attributes["use_existing_cloudtrail"] = true
attributes["cloudtrail_name"] = args.CloudtrailName
attributes["bucket_arn"] = args.ExistingCloudtrailBucketArn
} else {
if args.BucketName != "" {
Expand Down
Loading