Skip to content

Commit

Permalink
v0.0.3
Browse files Browse the repository at this point in the history
Various bug fixes (#10)

* update lambda concurrency
* lambda@edge in us-east-1
* remove region pin
* bump version
* doc update
  • Loading branch information
wellsiau-aws authored Sep 12, 2024
1 parent cde1f25 commit 72f4543
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions .config/functional_tests/pre-entrypoint-helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ cd ${PROJECT_PATH}

#********** TFC Env Vars *************
export AWS_DEFAULT_REGION=us-west-2
export AWS_REGION=us-west-2
export TFE_TOKEN=`aws secretsmanager get-secret-value --secret-id abp/hcp/token --region $AWS_DEFAULT_REGION | jq -r ".SecretString"`
export TF_TOKEN_app_terraform_io=`aws secretsmanager get-secret-value --secret-id abp/hcp/token --region $AWS_DEFAULT_REGION | jq -r ".SecretString"`

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ To use this module you need have the following:
| <a name="input_lambda_architecture"></a> [lambda\_architecture](#input\_lambda\_architecture) | Lambda architecture (arm64 or x86\_64) | `string` | `"x86_64"` | no |
| <a name="input_lambda_default_timeout"></a> [lambda\_default\_timeout](#input\_lambda\_default\_timeout) | Lambda default timeout in seconds | `number` | `120` | no |
| <a name="input_lambda_python_runtime"></a> [lambda\_python\_runtime](#input\_lambda\_python\_runtime) | Lambda Python runtime | `string` | `"python3.11"` | no |
| <a name="input_lambda_reserved_concurrency"></a> [lambda\_reserved\_concurrency](#input\_lambda\_reserved\_concurrency) | Maximum Lambda reserved concurrency, make sure your AWS quota is sufficient | `number` | `100` | no |
| <a name="input_lambda_reserved_concurrency"></a> [lambda\_reserved\_concurrency](#input\_lambda\_reserved\_concurrency) | Maximum Lambda reserved concurrency, make sure your AWS quota is sufficient | `number` | `10` | no |
| <a name="input_name_prefix"></a> [name\_prefix](#input\_name\_prefix) | Name to be used on all the resources as identifier. | `string` | `"runtask-tf-plan-analyzer"` | no |
| <a name="input_recovery_window"></a> [recovery\_window](#input\_recovery\_window) | Number of days that AWS Secrets Manager waits before it can delete the secret | `number` | `0` | no |
| <a name="input_run_task_iam_roles"></a> [run\_task\_iam\_roles](#input\_run\_task\_iam\_roles) | List of IAM roles to be attached to the Lambda function | `list(string)` | `null` | no |
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.0.2
v0.0.3
1 change: 1 addition & 0 deletions lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ resource "aws_cloudwatch_log_group" "runtask_callback" {

################# Run task Edge ##################
resource "aws_lambda_function" "runtask_edge" {
provider = aws.cloudfront_waf # Lambda@Edge must be in us-east-1
function_name = "${local.solution_prefix}-runtask-edge"
description = "HCP Terraform run task - Lambda@Edge handler"
role = aws_iam_role.runtask_edge.arn
Expand Down
2 changes: 1 addition & 1 deletion lambda/runtask_fulfillment/ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def guardrail_inspection(input_text, input_mode = 'OUTPUT'):

else:
return True, "Guardrail inspection skipped"

def clean_response(json_str):
# Remove any tags in the format <tag> or </tag>
cleaned_str = re.sub(r'<\/?[\w\s]+>', '', json_str)
Expand Down
4 changes: 1 addition & 3 deletions lambda/runtask_fulfillment/tools/get_ami_releases.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
from utils import logger

session = boto3.Session()
aws_region = "us-east-1"
ec2_client = session.client(service_name="ec2", region_name=aws_region)

ec2_client = session.client(service_name="ec2")

class GetECSAmisReleases:
def execute(self, ami_ids):
Expand Down
4 changes: 4 additions & 0 deletions tests/01_mandatory.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# create additional *.tftest.hcl for your own unit / integration tests
# use tests/*.auto.tfvars to add non-default variables

provider "aws" {
region = "us-west-2"
}

run "mandatory_plan_basic" {
command = plan
module {
Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ variable "recovery_window" {
variable "lambda_reserved_concurrency" {
description = "Maximum Lambda reserved concurrency, make sure your AWS quota is sufficient"
type = number
default = 100
default = 10
}

variable "lambda_default_timeout" {
Expand Down

0 comments on commit 72f4543

Please sign in to comment.