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
Terraform module that creates a generic lambda function that runs newman tests against a postman collection.
5
6
6
7
This lambda function is intended for use with [CodeDeploy's lifecycle hooks](https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-hooks.html).
@@ -10,38 +11,34 @@ This lambda function will tell CodeDeploy if the tests pass or fail.
10
11
#### [New to Terraform Modules at BYU?](https://github.com/byu-oit/terraform-documentation)
11
12
12
13
## Usage
13
-
You can provide a postman collection and environment to be tested in one of two ways:
Using this method allows you to not have to export your collection and commit the JSON file to your repo.
36
-
37
-
**Note:** The postman collection/environment must be viewable by the postman account tied to the API key you provide.
38
-
39
-
**Note 2:** Make sure your postman collection/environment names are unique, otherwise you will get an error if the postman API finds more than 1 collection/environment with the same name.
40
-
41
-
**DON'T** hard code your postman API key, treat it like all other secrets.
42
-
43
-
Then add your lambda function_name to the CodeDeploy lifecycle hook you want the postman tests to run on.
44
-
For instance, if you're using the [fargate-api module](https://github.com/byu-oit/terraform-aws-fargate-api):
| app_name | string | Application name to prefix your postman test lambda function's name ||
81
-
| postman_collection_file | string | Path to the postman collection JSON file relative from terraform dir (must be provided with postman_environment_file) | null |
82
-
| postman_environment_file | string | Path to the postman environment JSON file relative from terraform dir (must be provided with postman_collection_file) | null |
83
-
| postman_files_bucket_name | string | S3 Bucket name for the S3 Bucket this module will upload the postman_collection_file and postman_environment_file to | <app_name>-postman-files |
84
-
| postman_collection_name | string | Name of Postman collection to download from Postman API (must be provided with postman_api_key and postman_environment_name) | null |
85
-
| postman_environment_name | string | Name of Postman environment to download from Postman API (must be provided with postman_api_key and postman_collection_name) | null |
86
-
| postman_api_key | string | postman API key to download collection and environment from Postman API (must be provided with postman_collection_name and postman_environment_name) | null |
112
+
| postman_collections | list([object](#postman_collection))| List of postman collections and environments. See [postman_collection](#postman_collection)||
113
+
| postman_api_key | string | Postman API key to download collections/environments from Postman API (must be provided if you provide any postman IDs in `postman_collection` variable) | null |
87
114
| role_permissions_boundary_arn | string | ARN of the IAM Role permissions boundary to place on each IAM role created ||
88
115
| log_retention_in_days | number | CloudWatch log group retention in days | 7 |
89
116
| tags | map(string) | A map of AWS Tags to attach to each resource created | {} |
@@ -92,7 +119,13 @@ module "lambda_api" {
92
119
| vpc_id | string | The id of the VPC the lambda will be behind if VPC configuration is desired. (must be provided with lambda_vpc_subnet_ids) | null |
93
120
| vpc_subnet_ids | list(string) | A list of subnet ids the lambda will be put in if VPC configuration is desired. (must be provided with vpc_id) |[]|
94
121
122
+
### postman_collection
123
+
Object defining the collection and environment to run.
124
+
***`collection`** - (Required) path to local collection json file or Postman collection ID
125
+
***`environment`** - (Optional) path to local environment json file or Postman environment ID (can be set to `null` if you don't want an environment on your postman collection)
| lambda_function |[object](https://www.terraform.io/docs/providers/aws/r/lambda_function.html#attributes-reference)| Created lambda function that runs newman to test the `postman_collection`|
@@ -102,8 +135,10 @@ module "lambda_api" {
102
135
| lambda_security_group |[object](https://www.terraform.io/docs/providers/aws/r/security_group.html#attributes-reference)| Created security group for the lambda's VPC configuration. |
103
136
104
137
## Contributing
138
+
105
139
To contribute to this terraform module make a feature branch and create a Pull Request to the `master` branch.
106
140
107
141
This terraform module bakes in the lambda function code in the committed [function.zip](lambda/dist/function.zip) file.
108
142
109
-
If you change the [index.js](lambda/src/index.js) file then you'll need to run `npm run package` and commit the [function.zip](lambda/dist/function.zip) file.
143
+
If you change the [index.js](lambda/src/index.js) file then you'll need to run `npm run package` and commit
144
+
the [function.zip](lambda/dist/function.zip) file.
0 commit comments