-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Outputs :: s3_module_settings | ||
|
|
||
| Here is an exmaple of using the `s3_module_settings` outputs. Here, we have a lot of s3 modules. We pack all the outputs into | ||
| a list, and then use the `s3_module_settings` from each to translate from a requested bucket name to the ARN. This is because | ||
| we can call the module with a bucket naem of `mybucket` with some settings to add the account ID and region (compressed or not) | ||
| and this helps us match it up with what was really created. | ||
|
|
||
| ```hcl | ||
| locals { | ||
| module_outputs = [ | ||
| module.s3_cdl-asset, | ||
| module.s3_cdl-athena, | ||
| module.s3_cdl-code, | ||
| module.s3_cdl-datalake, | ||
| } | ||
| s3_bucket_name_arns = { for s3 in local.module_outputs : s3.s3_module_settings["bucket_name"] => s3.s3_module_settings["resulting_bucket_arn"] } | ||
| } | ||
| ``` | ||
|
|
||
| The resulting data is like | ||
|
|
||
| ```hcl | ||
| s3_bucket_name_arns = { | ||
| "adsd-edl-prod-cdl-asset" = "arn:aws-us-gov:s3:::v-s3-adsd-edl-prod-cdl-asseet-818199694861-ugw1" | ||
| . | ||
| . | ||
| } | ||
| ``` |