Skip to content

Commit

Permalink
add example
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Mar 1, 2022
1 parent 5186969 commit 1bfde83
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions examples/outputs/s3_module_settings.md
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"
.
.
}
```

0 comments on commit 1bfde83

Please sign in to comment.