Skip to content

Commit

Permalink
Added usage with default provider to README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bebold-jhr committed Jan 10, 2024
1 parent 2df5c4e commit c05f8f2
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,41 @@ This module allows you to list AWS accounts of an organization in various forms.

## How to use

The role with which you are running terraform on this module requires the following permissions:

```text
"organizations:ListRoots",
"organizations:ListTagsForResource",
"organizations:ListAccounts",
"organizations:DescribeOrganization",
"organizations:ListAWSServiceAccessForOrganization"
```

Either the role on your default provider allows these actions already or you want to add them to that role.
Alternatively you can create a distinct role for this case. We'll have a look at both cases down below.

### Using default provider

Call the module using this provider and decide whether to include the management account in the output lists or not (default is `true`):

```hcl
module "lookup" {
source = "be-bold/account-lookup/aws"
version = "#.#.#"
include_management_account = false
}
```

**Done**. Now call one of the multiple output options:

````hcl
output "show" {
value = module.lookup.mapping_id_to_name
}
````

### Custom role

You need a role which allows the following actions:

```json
Expand Down Expand Up @@ -50,7 +85,7 @@ provider "aws" {
}
```

Call the module using this provider and decide whether to include the management account in the output lists or not:
**Done**. Now call the module using this provider and decide whether to include the management account in the output lists or not (default is `true`):

```hcl
module "lookup" {
Expand All @@ -71,5 +106,7 @@ output "show" {
}
````

## Further filtering

Use the [filter submodule](https://github.com/be-bold/terraform-aws-account-lookup/tree/main/modules/filter) for even more control on your lists.
Have a look at the **examples** as well.

0 comments on commit c05f8f2

Please sign in to comment.