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

s3 folders structure #442

Merged
merged 5 commits into from
Sep 11, 2023
Merged

s3 folders structure #442

merged 5 commits into from
Sep 11, 2023

Conversation

bcarranza
Copy link
Collaborator

@bcarranza bcarranza commented Sep 4, 2023

What is this?

A simple module to create folders in an s3 bucket

Inputs

inputs = {
  bucket_name = "${local.aws_region}-${local.account_id}-dp-dev-poc-sftp-data"
  folder_structure = templatefile("./folder_structure.json", {})
}

folder_structure.json
[
    "aaziz@exactpay.com",
    "aaziz@exactpay.com/640a465cd2f4b9576e8b9b79",
    "aaziz@exactpay.com/63c71e961c35406430780ead",
    "640a465cd2f4b9576e8b9b79",
    "63c71e961c35406430780ead"
]

Evidence of proof

Terraform will perform the following actions:

  # aws_s3_object.directory_structure["0"] will be created
  + resource "aws_s3_object" "directory_structure" {
      + acl                    = (known after apply)
      + bucket                 = "us-west-2-042093043970-dp-dev-poc-sftp-data"
      + bucket_key_enabled     = (known after apply)
      + content_type           = "application/x-directory"
      + etag                   = (known after apply)
      + force_destroy          = false
      + id                     = (known after apply)
      + key                    = "aaziz@exactpay.com"
      + kms_key_id             = (known after apply)
      + server_side_encryption = (known after apply)
      + storage_class          = (known after apply)
      + tags_all               = (known after apply)
      + version_id             = (known after apply)
    }

  # aws_s3_object.directory_structure["1"] will be created
  + resource "aws_s3_object" "directory_structure" {
      + acl                    = (known after apply)
      + bucket                 = "us-west-2-042093043970-dp-dev-poc-sftp-data"
      + bucket_key_enabled     = (known after apply)
      + content_type           = "application/x-directory"
      + etag                   = (known after apply)
      + force_destroy          = false
      + id                     = (known after apply)
      + key                    = "aaziz@exactpay.com/640a465cd2f4b9576e8b9b79"
      + kms_key_id             = (known after apply)
      + server_side_encryption = (known after apply)
      + storage_class          = (known after apply)
      + tags_all               = (known after apply)
      + version_id             = (known after apply)
    }

  # aws_s3_object.directory_structure["2"] will be created
  + resource "aws_s3_object" "directory_structure" {
      + acl                    = (known after apply)
      + bucket                 = "us-west-2-042093043970-dp-dev-poc-sftp-data"
      + bucket_key_enabled     = (known after apply)
      + content_type           = "application/x-directory"
      + etag                   = (known after apply)
      + force_destroy          = false
      + id                     = (known after apply)
      + key                    = "aaziz@exactpay.com/63c71e961c35406430780ead"
      + kms_key_id             = (known after apply)
      + server_side_encryption = (known after apply)
      + storage_class          = (known after apply)
      + tags_all               = (known after apply)
      + version_id             = (known after apply)
    }

  # aws_s3_object.directory_structure["3"] will be created
  + resource "aws_s3_object" "directory_structure" {
      + acl                    = (known after apply)
      + bucket                 = "us-west-2-042093043970-dp-dev-poc-sftp-data"
      + bucket_key_enabled     = (known after apply)
      + content_type           = "application/x-directory"
      + etag                   = (known after apply)
      + force_destroy          = false
      + id                     = (known after apply)
      + key                    = "640a465cd2f4b9576e8b9b79"
      + kms_key_id             = (known after apply)
      + server_side_encryption = (known after apply)
      + storage_class          = (known after apply)
      + tags_all               = (known after apply)
      + version_id             = (known after apply)
    }

  # aws_s3_object.directory_structure["4"] will be created
  + resource "aws_s3_object" "directory_structure" {
      + acl                    = (known after apply)
      + bucket                 = "us-west-2-042093043970-dp-dev-poc-sftp-data"
      + bucket_key_enabled     = (known after apply)
      + content_type           = "application/x-directory"
      + etag                   = (known after apply)
      + force_destroy          = false
      + id                     = (known after apply)
      + key                    = "63c71e961c35406430780ead"
      + kms_key_id             = (known after apply)
      + server_side_encryption = (known after apply)
      + storage_class          = (known after apply)
      + tags_all               = (known after apply)
      + version_id             = (known after apply)
    }

Plan: 5 to add, 0 to change, 0 to destroy.

Apply


aws_s3_object.directory_structure["2"]: Creating...
aws_s3_object.directory_structure["3"]: Creating...
aws_s3_object.directory_structure["4"]: Creating...
aws_s3_object.directory_structure["0"]: Creating...
aws_s3_object.directory_structure["1"]: Creating...
aws_s3_object.directory_structure["2"]: Creation complete after 1s [id=aaziz@exactpay.com/63c71e961c35406430780ead]
aws_s3_object.directory_structure["4"]: Creation complete after 1s [id=63c71e961c35406430780ead]
aws_s3_object.directory_structure["1"]: Creation complete after 1s [id=aaziz@exactpay.com/640a465cd2f4b9576e8b9b79]
aws_s3_object.directory_structure["0"]: Creation complete after 1s [id=aaziz@exactpay.com]
aws_s3_object.directory_structure["3"]: Creation complete after 1s [id=640a465cd2f4b9576e8b9b79]
Releasing state lock. This may take a few moments...

Apply complete! Resources: 5 added, 0 changed, 0 destroyed.
Screenshot 2023-09-05 at 21 20 20

@sekka1 sekka1 merged commit da99b8c into main Sep 11, 2023
@sekka1 sekka1 deleted the s3-folders branch September 11, 2023 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants