How to create a folder inside S3 Bucket using Terraform code

0 votes

Hi Guys,

I am new to Terraform. I have one s3 Bucket in AWS. I want to create one folder inside this bucket using Terraform code. How can I do that?

Jul 23, 2020 in Terraform by akhtar
• 38,230 points
2,644 views

1 answer to this question.

0 votes

Hi@akhtar,

You can create a folder at the time of creating an S3 bucket. You will find one resource aws_s3_bucket_object that will help us to create one folder inside the S3 bucket. I have attached one example below for your reference.

resource "aws_s3_bucket_object" "folder1" {
    bucket = "${aws_s3_bucket.b.id}"
    acl    = "private"
    key    = "Folder1/"
    source = "/dev/null"
}
answered Jul 23, 2020 by MD
• 95,440 points

Related Questions In Terraform

0 votes
1 answer

How to create a route table in AWS using Terraform code?

Hi@akhtar, You can use aws_route_table resources in your ...READ MORE

answered Jul 21, 2020 in Terraform by MD
• 95,440 points
5,274 views
0 votes
1 answer

How to create one S3 bucket in AWS using Terraform?

Hi@akhtar, You need to set aws provider name ...READ MORE

answered Jul 23, 2020 in Terraform by MD
• 95,440 points
992 views
0 votes
1 answer

How to create a VPC in GCP Cloud using Terraform code?

Hi@akhtar, You can create your own VPC in ...READ MORE

answered Sep 13, 2020 in Terraform by MD
• 95,440 points
1,398 views
0 votes
1 answer

How to create a namespace in minikube using Terraform?

Hi@akhtar, You can use kubernetes_namespace resource. It is used ...READ MORE

answered Jun 30, 2020 in Terraform by MD
• 95,440 points
1,390 views
+1 vote
2 answers

AWS CloudWatch Logs in Docker

The awslogs works without using ECS. you need to configure ...READ MORE

answered Sep 7, 2018 in AWS by bug_seeker
• 15,520 points
1,706 views
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,090 points
2,435 views
0 votes
1 answer

How to create a folder in S3 bucket using terraform?

Hi@akhtar, You can use aws_s3_bucket_object resource to create one ...READ MORE

answered Jun 11, 2020 in Terraform by MD
• 95,440 points
10,019 views
0 votes
1 answer

How to create one s3 bucket using terraform?

Hi@akhtar, You can use aws_s3_bucket resources to create ...READ MORE

answered Jun 12, 2020 in Terraform by MD
• 95,440 points
3,670 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP