Skip to content

Commit

Permalink
Update versions of many modules and providers
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleKotowick committed Apr 28, 2023
1 parent 4003573 commit a3071b3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions archive.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// If the archive_output_name variable is provided, it must end in ".zip"
module "assert_proper_output_archive_name" {
source = "Invicton-Labs/assertion/null"
version = "0.2.1"
version = "~>0.2.4"
count = var.archive_output_name != null ? 1 : 0
condition = length(var.archive_output_name) > 4 && lower(substr(var.archive_output_name, length(var.archive_output_name) - 4, 4)) == ".zip" && length(regexall("[/\\\\]+", var.archive_output_name)) == 0
error_message = "The `archive_output_name` variable, if provided, must end in `.zip` and may not contain `\\` or `/`."
error_message = "The `archive_output_name` variable, if provided, must end in `.zip` and may not contain `\\` or `/` (received: \"${var.archive_output_name}\")."
}

// Create a UUID to be used for the output archive file name, so it doesn't clash with others
Expand Down
14 changes: 7 additions & 7 deletions assertions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Assert that we've only provided a single source for the Lambda code
module "assert_single_source1" {
source = "Invicton-Labs/assertion/null"
version = "0.2.1"
version = "~>0.2.4"
condition = var.source_directory == null || (
var.unzipped_source_file == null &&
var.lambda_config.filename == null &&
Expand All @@ -16,7 +16,7 @@ module "assert_single_source1" {
}
module "assert_single_source2" {
source = "Invicton-Labs/assertion/null"
version = "0.2.1"
version = "~>0.2.4"
condition = var.unzipped_source_file == null || (
var.source_directory == null &&
var.lambda_config.filename == null &&
Expand All @@ -32,39 +32,39 @@ module "assert_single_source2" {
// Ensure that if a filename is provided, no source hash is provided (it will automatically be calculated)
module "assert_filename_source_hash" {
source = "Invicton-Labs/assertion/null"
version = "0.2.1"
version = "~>0.2.4"
condition = var.lambda_config.filename == null ? true : var.lambda_config.source_code_hash == null
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)."
}

// Ensure that if an IAM role for the Lambda execution was provided, there weren't also IAM policy ARNs provided
module "assert_no_policy_arns_for_provided_role" {
source = "Invicton-Labs/assertion/null"
version = "0.2.1"
version = "~>0.2.4"
condition = var.lambda_config.role == null ? true : length(var.role_policy_arns) == 0
error_message = "The `role_policy_arns` variable cannot be provided if the `role` field in the `lambda_config` variable is provided."
}

// Ensure that if an IAM role for the Lambda execution was provided, there weren't also IAM policies provided
module "assert_no_policies_for_provided_role" {
source = "Invicton-Labs/assertion/null"
version = "0.2.1"
version = "~>0.2.4"
condition = var.lambda_config.role == null ? true : length(var.role_policies) == 0
error_message = "The `role_policies` variable cannot be provided if the `role` field in the `lambda_config` variable is provided."
}

// Ensure that Edge functions are only defined in the us-east-1 region
module "assert_edge_region" {
source = "Invicton-Labs/assertion/null"
version = "0.2.1"
version = "~>0.2.4"
condition = !var.edge ? true : data.aws_region.current.name == "us-east-1"
error_message = "If the `edge` variable is `true`, the lambda must be created in the `us-east-1` region."
}

// Ensure that Edge functions are published
module "assert_edge_published" {
source = "Invicton-Labs/assertion/null"
version = "0.2.1"
version = "~>0.2.4"
condition = !var.edge ? true : var.lambda_config.publish == true
error_message = "If the `edge` variable is `true`, the `publish` variable in `lambda_config` must also be `true`."
}
2 changes: 1 addition & 1 deletion logs.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Create the Cloudwatch log group
module "log_group" {
source = "Invicton-Labs/log-group/aws"
version = "~>0.4.0"
version = "~>0.5.0"
log_group_config = {
name = "/aws/lambda/${var.edge ? "us-east-1." : ""}${var.lambda_config.function_name}"
retention_in_days = var.cloudwatch_logs_retention_days
Expand Down
6 changes: 3 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
terraform {
required_version = ">= 1.3"
required_version = ">= 1.4.6"
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.47"
version = ">= 4.64"
}
archive = {
source = "hashicorp/archive"
version = ">= 2.2.0"
version = ">= 2.3.0"
}
}
}
Expand Down

0 comments on commit a3071b3

Please sign in to comment.