Skip to content

Commit dbbc143

Browse files
committed
update README.md with azure-functions
1 parent cca051b commit dbbc143

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

governance/third-generation/README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ You can find most of the common functions used in the third-generation policies
3333
* [tfconfig-functions](./common-functions/tfconfig-functions)
3434
* [tfrun-functions](./common-functions/tfrun-functions)
3535

36-
There are also some functions used to validate assumed roles for the AWS provider in [aws-functions](./aws/aws-functions).
36+
There are also some functions that can be used with the AWS and Azure providers in [aws-functions](./aws/aws-functions) and [azure-functions](./azure/azure-functions).
3737

3838
Unlike the second-generation common functions that were each defined in a separate file, all of the common functions that use any of the 4 Terraform Sentinel imports (tfplan/v2, tfstate/v2, tfconfig/v2, and tfrun) are defined in a single file. This makes it easier to import all of the functions that use one of those imports into the Sentinel CLI test cases and Terraform Cloud policy sets, since those only need a single stanza such as this one for each module:
3939
```
@@ -43,7 +43,7 @@ Unlike the second-generation common functions that were each defined in a separa
4343
}
4444
}
4545
```
46-
Test cases that use the other modules would either change all three occurrences of "tfplan" in that stanza to "tfstate", "tfconfig", or "tfrun" or would add additional stanzas with those changes.
46+
Test cases that use the other modules would either change all three occurrences of "tfplan" in that stanza to "tfstate", "tfconfig", "tfrun", "aws", or "azure" or would add additional stanzas with those changes.
4747

4848
We have put each Sentinel module in its own directory which also contains Markdown files for each of the module's functions under a docs directory. Each of these Markdown files describes the function, its declaration, its arguments, other common functions it uses, what it returns, and what it prints. It also gives examples of calling the function and sometimes lists some policies that call it.
4949

@@ -56,8 +56,9 @@ import "tfstate-functions" as state
5656
import "tfconfig-functions" as config
5757
import "tfrun-functions" as run
5858
import "aws-functions" as aws
59+
import "azure-functions" as azure
5960
```
60-
In this case, we are using `plan`, `state`, `config`, `run`, and `aws` as aliases for the five imports to keep lines that use their functions shorter. Of course, you only need to import the modules that contain functions that your policy actually calls.
61+
In this case, we are using `plan`, `state`, `config`, `run`, `aws`, and `azure` as aliases for the six imports to keep lines that use their functions shorter. Of course, you only need to import the modules that contain functions that your policy actually calls.
6162

6263
### The Functions of the tfplan-functions and tfstate-functions Modules
6364
We discuss these two modules together because they are essentially identical except for their use of the tfplan/v2 and tfstate/v2 imports.
@@ -106,7 +107,7 @@ Documentation for each individual function can be found in this directory:
106107

107108
### The Functions of the aws-functions Module
108109
The `aws-functions` module (which is located under in the aws/aws-functions directory) has the following functions:
109-
* The `find_resources_with_standard_tags` function finds all AWS resources that use standard AWS tags in the current plan that are being created or modified.
110+
* The `find_resources_with_standard_tags` function finds all AWS resources of specified types that should have tags in the current plan that are not being permanently deleted.
110111
* The `determine_role_arn` function determines the ARN of a role set in the `role_arn` parameter of an AWS provider. It can only determine the role_arn if it is set to either a hard-coded value or to a reference to a single Terraform variable. It sets the role to "complex" if it finds a single non-variable reference or if it finds multiple references. It sets the role to "none" if no role arn is found.
111112
* The `get_assumed_roles` function gets all roles assumed by AWS providers in the current Terraform configuration. It calls the `determine_role_arn` function.
112113
* The `validate_assumed_roles_with_list` function validates assumed roles found by the `get_assumed_roles` function against a list of role ARNs.
@@ -115,6 +116,13 @@ The `aws-functions` module (which is located under in the aws/aws-functions dire
115116
Documentation for each individual function can be found in this directory:
116117
* [aws-functions](./aws/aws-functions/docs)
117118

119+
### The Functions of the azure-functions Module
120+
The `azure-functions` module (which is located under in the azure/azure-functions directory) has the following functions:
121+
* The `find_resources_with_standard_tags` function finds all Azure resources of specified types that should have tags in the current plan that are not being permanently deleted.
122+
123+
Documentation for each individual function can be found in this directory:
124+
* [azure-functions](./azure/azure-functions/docs)
125+
118126
## Mock Files and Test Cases
119127
Sentinel [mock files](https://www.terraform.io/docs/enterprise/sentinel/mock.html) and [test cases](https://docs.hashicorp.com/sentinel/commands/config#test-cases) have been provided under the test directory of each cloud so that all the policies can be tested with the [Sentinel CLI](https://docs.hashicorp.com/sentinel/commands). The mocks were generated from actual Terraform 0.12 plans run against Terraform code that provisioned resources in these clouds. The pass and fail mock files were edited to respectively pass and fail the associated Sentinel policies. Some policies, including those that have multiple rules, have multiple fail mock files with names that indicate which condition or conditions they fail.
120128

0 commit comments

Comments
 (0)