You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This function filters instances of the AWS provider to those in a specific region using the tfconfig/v2 and tfplan/v2 imports.
4
+
5
+
See the documentation for the [validate_provider_in_allowed_regions](./validate_provider_in_allowed_regions.md) function for details on how this is done.
6
+
7
+
## Sentinel Module
8
+
This function is contained in the [aws-functions.sentinel](../aws-functions.sentinel) module.
***aws_providers**: a collection of instances of the AWS provider derived from tfconfig.providers.
15
+
***allowed_regions**: a list of AWS regions given as strings like `["us-east-1" and "eu-west-2"]`
16
+
17
+
## Common Functions Used
18
+
This function calls the the `validate_provider_in_allowed_regions` of the [aws-functions.sentinel](../aws-functions.sentinel) module.
19
+
20
+
## What It Returns
21
+
This function returns a single flat map of AWS providers. The map is actually a filtered sub-collection of the [`tfconfig.providers`](https://www.terraform.io/docs/cloud/sentinel/import/tfconfig-v2.html#the-resources-collection) collection.
22
+
23
+
## What It Prints
24
+
This function currently prints providers that are validated to assist evaluation of the function when used by customers. In the future, we might remove that printing.
25
+
26
+
## Examples
27
+
Here is an example of calling this function, assuming that the aws-functions.sentinel file that contains it has been imported with the alias `aws`:
This function validates whether a specific instance of the AWS provider is in a list of regions. The provider instance should be derived from `tfconfig.providers` or from the `provider_config_key` of a resource derived from `tfconfig.resources`.
3
+
4
+
It attempts to identify the region of the provider aliases in several ways including constant values assigned to their `region` argument and resolution of references to variables. It first tries to process references to variables as strings, then as maps with a key called "region". It handles references to variables in the root module by using tfplan.variables. It handles references to variables in non-root modules by examining the module call from the current module's parent.
5
+
6
+
It even tries to match provider aliases in proxy configuration blocks (which do not specify regions) of child modules to similarly-named provider aliases in the root module.
7
+
8
+
If the alias passed in the module call does not match the alias in the root module, Sentinel has no way of linking the two provider aliases. However, since all providers that do specify regions will be restricted and since provider alias proxies must point to other provider aliases in ancestor modules, all provider aliases should be restricted by this policy.
9
+
10
+
## Sentinel Module
11
+
This function is contained in the [aws-functions.sentinel](../aws-functions.sentinel) module.
***p**: a specific alias of the AWS provider derived from `tfconfig.providers` or from the `provider_config_key` attribute of a resource derived from `tfconfig.resources`.
18
+
***regions**: a list of AWS AWS regions given as strings like `["us-east-1" and "eu-west-2"]`
19
+
20
+
## Common Functions Used
21
+
None
22
+
23
+
## What It Returns
24
+
This function returns a boolean indicating whether the provider alias was in one of the desired regions.
25
+
26
+
## What It Prints
27
+
This function does not print anything.
28
+
29
+
## Examples
30
+
Here is an example of calling this function, assuming that the aws-functions.sentinel file that contains it has been imported with the alias `aws`:
0 commit comments