Skip to content

Commit

Permalink
[WIP] - ASG Lambda Update
Browse files Browse the repository at this point in the history
- Added S3 Bucket as an origin to lambda zip file
- Only supports two regions [us-west-2, us-east-1 (Need Security Whitelist for other regions)]
- Tested & Working (See internal ZTW-1182)
* TODO: [Final QA Validation, Release Notes]
  • Loading branch information
nmizhquirizs committed Jul 15, 2024
1 parent 33e58b3 commit e5867d7
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions examples/base_cc_gwlb_asg/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ module "asg_lambda" {
secret_name = var.secret_name
autoscaling_group_names = module.cc_asg.autoscaling_group_ids
asg_lambda_filename = var.asg_lambda_filename
aws_region = var.aws_region
}


Expand Down
1 change: 1 addition & 0 deletions examples/base_cc_gwlb_asg_zpa/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ module "asg_lambda" {
secret_name = var.secret_name
autoscaling_group_names = module.cc_asg.autoscaling_group_ids
asg_lambda_filename = var.asg_lambda_filename
aws_region = var.aws_region
}


Expand Down
18 changes: 9 additions & 9 deletions modules/terraform-zscc-asg-lambda-aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,15 @@ resource "aws_iam_role_policy_attachment" "lambda_logs_attachment" {
# Create Lambda Function
################################################################################
resource "aws_lambda_function" "asg_lambda_function" {
function_name = "${var.name_prefix}_asg_lambda_function_${var.resource_tag}"
handler = "${var.asg_lambda_filename}.lambda_handler"
runtime = "python3.12"
filename = "${path.module}/${var.asg_lambda_filename}.zip"
source_code_hash = filebase64sha256("${path.module}/${var.asg_lambda_filename}.zip")
role = aws_iam_role.asg_lambda_iam_role.arn
timeout = 180 # executes for max 180 seconds
memory_size = 256
architectures = [var.architecture]
function_name = "${var.name_prefix}_asg_lambda_function_${var.resource_tag}"
handler = "${var.asg_lambda_filename}.lambda_handler"
runtime = "python3.12"
s3_bucket = "${var.s3_bucket}-${var.aws_region}"
s3_key = "${var.asg_lambda_filename}.zip"
role = aws_iam_role.asg_lambda_iam_role.arn
timeout = 180 # executes for max 180 seconds
memory_size = 256
architectures = [var.architecture]

environment {
variables = {
Expand Down
8 changes: 8 additions & 0 deletions modules/terraform-zscc-asg-lambda-aws/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
variable "aws_region" {
type = string
description = "The AWS region."
}
variable "s3_bucket" {
description = "S3 bucket containing Lambda deployment packages"
default = "zscaler-cc-lambda-service"
}
variable "name_prefix" {
type = string
description = "A prefix to associate to all the Cloud Connector module resources"
Expand Down
Binary file not shown.

0 comments on commit e5867d7

Please sign in to comment.