ManagedKube / kubernetes-ops

Running Kubernetes in production
Apache License 2.0
297 stars 136 forks source link

s3 folders structure #442

Closed bcarranza closed 1 year ago

bcarranza commented 1 year ago

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