11// Assert that we've only provided a single source for the Lambda code
22module "assert_single_source1" {
3- source = " Invicton-Labs /assertion/null"
4- version = " 0.2.1 "
3+ source = " Kalepa /assertion/null"
4+ version = " ~> 0.2"
55 condition = var. source_directory == null || (
66 var. unzipped_source_file == null &&
77 var. lambda_config . filename == null &&
@@ -15,8 +15,8 @@ module "assert_single_source1" {
1515 error_message = " The `source_directory` variable cannot be provided if the `unzipped_source_file` variable or any of the `filename`, `s3_bucket`, `s3_key`, `s3_object_version`, `image_uri`, `package_type`, or `image_config` fields in the `lambda_config` variable are provided."
1616}
1717module "assert_single_source2" {
18- source = " Invicton-Labs /assertion/null"
19- version = " 0.2.1 "
18+ source = " Kalepa /assertion/null"
19+ version = " ~> 0.2"
2020 condition = var. unzipped_source_file == null || (
2121 var. source_directory == null &&
2222 var. lambda_config . filename == null &&
@@ -31,40 +31,40 @@ module "assert_single_source2" {
3131}
3232// Ensure that if a filename is provided, no source hash is provided (it will automatically be calculated)
3333module "assert_filename_source_hash" {
34- source = " Invicton-Labs /assertion/null"
35- version = " 0.2.1 "
34+ source = " Kalepa /assertion/null"
35+ version = " ~> 0.2"
3636 condition = var. lambda_config . filename == null ? true : var. lambda_config . source_code_hash == null
3737 error_message = " The `source_code_hash` field in the `lambda_config` variable cannot be provided if the `filename` field in the `lambda_config` variable is provided (the source file hash will be automatically calculated)."
3838}
3939
4040// Ensure that if an IAM role for the Lambda execution was provided, there weren't also IAM policy ARNs provided
4141module "assert_no_policy_arns_for_provided_role" {
42- source = " Invicton-Labs /assertion/null"
43- version = " 0.2.1 "
42+ source = " Kalepa /assertion/null"
43+ version = " ~> 0.2"
4444 condition = var. lambda_config . role == null ? true : length (var. role_policy_arns ) == 0
4545 error_message = " The `role_policy_arns` variable cannot be provided if the `role` field in the `lambda_config` variable is provided."
4646}
4747
4848// Ensure that if an IAM role for the Lambda execution was provided, there weren't also IAM policies provided
4949module "assert_no_policies_for_provided_role" {
50- source = " Invicton-Labs /assertion/null"
51- version = " 0.2.1 "
50+ source = " Kalepa /assertion/null"
51+ version = " ~> 0.2"
5252 condition = var. lambda_config . role == null ? true : length (var. role_policies ) == 0
5353 error_message = " The `role_policies` variable cannot be provided if the `role` field in the `lambda_config` variable is provided."
5454}
5555
5656// Ensure that Edge functions are only defined in the us-east-1 region
5757module "assert_edge_region" {
58- source = " Invicton-Labs /assertion/null"
59- version = " 0.2.1 "
58+ source = " Kalepa /assertion/null"
59+ version = " ~> 0.2"
6060 condition = ! var. edge ? true : data. aws_region . current . name == " us-east-1"
6161 error_message = " If the `edge` variable is `true`, the lambda must be created in the `us-east-1` region."
6262}
6363
6464// Ensure that Edge functions are published
6565module "assert_edge_published" {
66- source = " Invicton-Labs /assertion/null"
67- version = " 0.2.1 "
66+ source = " Kalepa /assertion/null"
67+ version = " ~> 0.2"
6868 condition = ! var. edge ? true : var. lambda_config . publish == true
6969 error_message = " If the `edge` variable is `true`, the `publish` variable in `lambda_config` must also be `true`."
7070}
0 commit comments