|
| 1 | +# S3 Outputs Module |
| 2 | + |
| 3 | +This shared sub-module creates an S3 bucket for each Tecton module and stores all module outputs as JSON files in that bucket. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- Creates a dedicated S3 bucket for each module |
| 8 | +- Stores outputs as `outputs.json` (latest) and timestamped files for versioning |
| 9 | +- Enables bucket versioning and encryption |
| 10 | +- Blocks public access for security |
| 11 | + |
| 12 | +## Usage |
| 13 | + |
| 14 | +Add this to your module's `infrastructure.tf` or `main.tf`: |
| 15 | + |
| 16 | +```hcl |
| 17 | +module "s3_outputs" { |
| 18 | + source = "../s3_outputs" |
| 19 | + deployment_name = var.deployment_name |
| 20 | + module_name = "your-module-name" # e.g., "dataplane-rift", "controlplane", etc. |
| 21 | +
|
| 22 | + outputs_data = { |
| 23 | + # Include all outputs you want to store |
| 24 | + deployment_name = var.deployment_name |
| 25 | + region = var.region |
| 26 | + # ... add all other outputs from your outputs.tf |
| 27 | + } |
| 28 | +
|
| 29 | + # Ensure S3 outputs are created after all other resources |
| 30 | + depends_on_resources = [ |
| 31 | + # List all modules that should be created first |
| 32 | + module.tecton, |
| 33 | + module.rift |
| 34 | + ] |
| 35 | +} |
| 36 | +``` |
| 37 | + |
| 38 | +Then add these to your module's `outputs.tf`: |
| 39 | + |
| 40 | +```hcl |
| 41 | +# S3 outputs bucket information |
| 42 | +output "outputs_bucket_name" { |
| 43 | + description = "Name of the S3 bucket storing module outputs" |
| 44 | + value = module.s3_outputs.bucket_name |
| 45 | +} |
| 46 | +
|
| 47 | +output "outputs_bucket_arn" { |
| 48 | + description = "ARN of the S3 bucket storing module outputs" |
| 49 | + value = module.s3_outputs.bucket_arn |
| 50 | +} |
| 51 | +
|
| 52 | +output "outputs_s3_uri" { |
| 53 | + description = "S3 URI of the outputs.json file" |
| 54 | + value = module.s3_outputs.outputs_s3_uri |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +<!-- BEGIN_TF_DOCS --> |
| 59 | + |
| 60 | +## Providers |
| 61 | + |
| 62 | +| Name | Version | |
| 63 | +|------|---------| |
| 64 | +| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a | |
| 65 | +## Inputs |
| 66 | + |
| 67 | +| Name | Description | Type | Default | Required | |
| 68 | +|------|-------------|------|---------|:--------:| |
| 69 | +| <a name="input_control_plane_account_id"></a> [control\_plane\_account\_id](#input\_control\_plane\_account\_id) | AWS account ID of the control plane | `string` | n/a | yes | |
| 70 | +| <a name="input_depends_on_resources"></a> [depends\_on\_resources](#input\_depends\_on\_resources) | List of resources that must be created before writing outputs | `list(any)` | `[]` | no | |
| 71 | +| <a name="input_deployment_name"></a> [deployment\_name](#input\_deployment\_name) | Name of the Tecton deployment | `string` | n/a | yes | |
| 72 | +| <a name="input_outputs_data"></a> [outputs\_data](#input\_outputs\_data) | Map of outputs data to store in S3 | `map(any)` | n/a | yes | |
| 73 | +| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags to apply to resources | `map(string)` | `{}` | no | |
| 74 | +## Outputs |
| 75 | + |
| 76 | +| Name | Description | |
| 77 | +|------|-------------| |
| 78 | +| <a name="output_bucket_arn"></a> [bucket\_arn](#output\_bucket\_arn) | ARN of the S3 bucket storing outputs | |
| 79 | +| <a name="output_bucket_name"></a> [bucket\_name](#output\_bucket\_name) | Name of the S3 bucket storing outputs | |
| 80 | +| <a name="output_outputs_s3_uri"></a> [outputs\_s3\_uri](#output\_outputs\_s3\_uri) | S3 URI of the outputs.json file | |
| 81 | +<!-- END_TF_DOCS --> |
0 commit comments