AWS s3 subfolders creation

17 views
Skip to first unread message

sushant kode

unread,
Jun 5, 2021, 2:48:17 AMJun 5
to Terraform
Hi All,
We have a requirement to create  a particular set of folders and subfolders in a s3 bucket. Bucket will be having a folder with env name (eg. level 1-> dev). Now dev will have 3 subfolders (eg. level 2-> incoming, outgoing, error). Now each of the subfolder will be 2 more subfolders(eg. level 3-> orange, black). 
the folder structure:
dev/
dev/incoming
dev/outgoing
dev/error
dev/incoming/orange
dev/incoming/black
dev/ outgoing /orange
dev/ outgoing /black
dev/ error /orange
dev/ error /black
There is possibility of having level 4 subfolder structure. Is there a way in terraform to create these folders and subfolders keeping the code generic, so that it can be used for other buckets across environments. 

Thanks in Advance. 

Fernando 🐼

unread,
Jun 5, 2021, 4:42:47 AMJun 5
to terrafo...@googlegroups.com
Object storage, like aws s3, does not have a concept of folders. 
Every object has a key, and that key is the path to it. 
Folders, directories, etc, do not represent keys and as such don't really exist. 

Object storage is not a file system! 

--
Fernando 🐼

--
In the coming weeks, inbound messages to this group will be disabled, and it will be used for outbound announcements only. To prepare for this switch, please direct questions and conversations to our primary medium to communicate with practitioners: https://discuss.hashicorp.com/c/terraform-core/27. We look forward to collaborating with you there!
 
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/5b105ee1-fa0e-4a0b-bdec-4a9e52f9b536n%40googlegroups.com.

Sam Flint

unread,
Jun 8, 2021, 10:22:34 AMJun 8
to terrafo...@googlegroups.com
You can specify any bucket path when writing to it.   No need to create them ahead of time with terraform.

Alexandra Freeman

unread,
Jun 21, 2021, 10:31:08 AMJun 21
to Terraform
Hello and thank you for your question!
On June 3, 2019 HashiCorp launched Discuss, a forum to facilitate dialogue within the HashiCorp community. This format allows answers to be more readily searched and indexed, making it easier to find answers to existing questions and to share knowledge with each other. Please direct all questions and conversations to the discussion forum. We look forward to collaborating with you there!

Cheers!

Reply all
Reply to author
Forward
0 new messages