Skip to main content
Knowledge Base

How to create S3 bucket with SSL enaled using aws.CreateS3Bucket function in goland terratest

Answer

Could you please let me know how can i create S3 bucket in terratest golang along with Encryption of data transfer is enabled using SSL for the buckets created using [CreateS3Bucket](https://github.com/gruntwork-io/terratest/blob/v0.40.0/modules/aws/s3.go#L132) [¶](https://pkg.go.dev/github.com/gruntwork-io/terratest/modules/aws#CreateS3Bucket) function **Note** : I am creating backend S3 bucket using [CreateS3Bucket](https://github.com/gruntwork-io/terratest/blob/v0.40.0/modules/aws/s3.go#L132) function just to store state files but security team is firing alarm in our organization saying these buckets are not enabled with Data transfer encryption using SSL , hence i am looking for a way to create these S3 buckets with SSL enabled or add encryption even after creation is also fine

Hi, from a quick search in terratest codebase - looks like it is not supported now, but I think can be used S3 API directly to enable server-side encryption like: https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/go/example_code/s3/s3_set_default_encryption.go#L57