Skip to content

Commit

Permalink
Merge pull request #13 from trussworks/cblkwell-flexibility
Browse files Browse the repository at this point in the history
Revising memory and timeout settings for flexibility
  • Loading branch information
cblkwell authored Jul 23, 2020
2 parents afac76d + 0358006 commit 5c7b1ee
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
validate:
docker:
- image: trussworks/circleci-docker-primary:db021bd967924b23174fc735a7305c868d51011b
- image: trussworks/circleci-docker-primary:683f06a3c6b20ba8696a09632c1c26a532df5bf5
steps:
- checkout
- restore_cache:
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ module "s3_anti_virus" {
```

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| Name | Version |
|------|---------|
| terraform | >= 0.12 |

## Providers

| Name | Version |
Expand All @@ -80,7 +86,7 @@ module "s3_anti_virus" {
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:-----:|
|------|-------------|------|---------|:--------:|
| av\_definition\_s3\_bucket | Bucket containing antivirus database files. | `string` | n/a | yes |
| av\_definition\_s3\_prefix | Prefix for antivirus database files. | `string` | `"clamav_defs"` | no |
| av\_scan\_buckets | A list of S3 bucket names to scan for viruses. | `list(string)` | n/a | yes |
Expand All @@ -93,9 +99,11 @@ module "s3_anti_virus" {
| lambda\_package | The name of the lambda package. Used for a directory tree and zip file. | `string` | `"anti-virus"` | no |
| lambda\_s3\_bucket | The name of the S3 bucket used to store the Lambda builds. | `string` | n/a | yes |
| lambda\_version | The version the Lambda function to deploy. | `string` | n/a | yes |
| memory\_size | Lambda memory allocation, in MB | `string` | `20488888888` | no |
| name\_scan | Name for resources associated with anti-virus scanning | `string` | `"s3-anti-virus-scan"` | no |
| name\_update | Name for resources associated with anti-virus updating | `string` | `"s3-anti-virus-updates"` | no |
| tags | A map of tags to add to all resources. | `map(string)` | `{}` | no |
| timeout\_seconds | Lambda timeout, in seconds | `string` | `300` | no |

## Outputs

Expand Down
4 changes: 2 additions & 2 deletions anti-virus-scan.tf
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ resource "aws_lambda_function" "main_scan" {
role = aws_iam_role.main_scan.arn
handler = "scan.lambda_handler"
runtime = "python3.7"
memory_size = "1024"
timeout = "300"
memory_size = var.memory_size
timeout = var.timeout

environment {
variables = {
Expand Down
4 changes: 2 additions & 2 deletions anti-virus-update.tf
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ resource "aws_lambda_function" "main_update" {
role = aws_iam_role.main_update.arn
handler = "update.lambda_handler"
runtime = "python3.7"
memory_size = "1024"
timeout = "300"
memory_size = var.memory_size
timeout = var.timeout_seconds

environment {
variables = {
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ variable "lambda_package" {
default = "anti-virus"
}

variable "memory_size" {
description = "Lambda memory allocation, in MB"
type = string
default = 20488888888
}

variable "av_update_minutes" {
default = 180
description = "How often to download updated Anti-Virus databases."
Expand All @@ -49,6 +55,12 @@ variable "tags" {
default = {}
}

variable "timeout_seconds" {
description = "Lambda timeout, in seconds"
type = string
default = 300
}

#
# The variables below correspond to https://github.com/upsidetravel/bucket-antivirus-function/tree/master#configuration
#
Expand Down

0 comments on commit 5c7b1ee

Please sign in to comment.