Skip to content

Terraform module to upload N number of (optionally templated) local files to S3 with distinct keys. - repo managed by sudoblark.terraform.github

License

Notifications You must be signed in to change notification settings

sudoblark/sudoblark.terraform.module.aws.s3_files

Repository files navigation

sudoblark.terraform.module.aws.s3_files

Terraform module to upload N number of (optionally templated) local files to S3 with distinct keys. - repo managed by sudoblark.terraform.github

Developer documentation

The below documentation is intended to assist a developer with interacting with the Terraform module in order to add, remove or update functionality.

Pre-requisites

  • terraform_docs
brew install terraform_docs
  • tfenv
git clone https://github.com/tfutils/tfenv.git ~/.tfenv
echo 'export PATH="$HOME/.tfenv/bin:$PATH"' >> ~/.bash_profile
  • Virtual environment with pre-commit installed
python3 -m venv venv
source venv/bin/activate
pip install pre-commit

Pre-commit hooks

This repository utilises pre-commit in order to ensure a base level of quality on every commit. The hooks may be installed as follows:

source venv/bin/activate
pip install pre-commit
pre-commit install
pre-commit run --all-files

Module documentation

The below documentation is intended to assist users in utilising the module, the main thing to note is the data structure section which outlines the interface by which users are expected to interact with the module itself, and the examples section which has examples of how to utilise the module.

Requirements

Name Version
terraform ~> 1.5.0
aws >= 5.61.0

Providers

Name Version
aws 5.67.0

Modules

No modules.

Resources

Name Type
aws_s3_object.uploaded_files resource

Inputs

Name Description Type Default Required
raw_s3_files Data structure
---------------
A list of dictionaries, where each dictionary has the following attributes:

REQUIRED
---------
- name: : Friendly name used through Terraform for instantiation and cross-referencing of resources,
only relates to resource naming within the module.
- source_folder : Which folder where the {source_file} lives.
- source_file : The path under {source_folder} corresponding to the file to upload.
- destination_key : Key in S3 bucket to upload to.
- destination_bucket : The S3 bucket to upload the {source_file} to.

OPTIONAL
---------
- template_input : A dictionary of variable input for the template file needed for instantiation (leave blank if no template required)
list(
object({
name = string,
source_folder = string,
source_file = string,
destination_key = string,
destination_bucket = string,
template_input = optional(map(string), {})
})
)
n/a yes

Outputs

No outputs.

Data structure

Data structure
---------------
A list of dictionaries, where each dictionary has the following attributes:

REQUIRED
---------
- name:                 : Friendly name used through Terraform for instantiation and cross-referencing of resources,
                          only relates to resource naming within the module.
- source_folder         : Which folder where the {source_file} lives.
- source_file           : The path under {source_folder} corresponding to the file to upload.
- destination_key       : Key in S3 bucket to upload to.
- destination_bucket    : The S3 bucket to upload the {source_file} to.

OPTIONAL
---------
- template_input        : A dictionary of variable input for the template file needed for instantiation (leave blank if no template required)

Examples

See examples folder for an example setup.

About

Terraform module to upload N number of (optionally templated) local files to S3 with distinct keys. - repo managed by sudoblark.terraform.github

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages