diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index cc9d9b1..1a0271e 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -385,3 +385,13 @@ pipelines: - *aws-context-uat - pip install -r requirements.txt - IS_DEPLOY_ALL=true python terraform.py apply --environment=uat --module=textract-pipeline/terraform --apply-extra-args="-target=null_resource.snowsql_client_create" + + feature/UAT-pdf-layer-test: + - step: + name: Apply textract-pipeline on UAT (pdf layer) + image: hugree/bitbucket-aws-python38-tf154:latest + oidc: true + script: + - *aws-context-uat + - pip install -r requirements.txt + - BB_PIPELINE_BRANCH="UAT" python terraform.py apply --environment=uat --module=textract-pipeline/terraform --apply-extra-args="-target=module.pdf_layer" \ No newline at end of file diff --git a/textract-pipeline/src/lambda-layer/pypdf2-layer-new/requirements.txt b/textract-pipeline/src/lambda-layer/pypdf2-layer-new/requirements.txt new file mode 100644 index 0000000..d682eda --- /dev/null +++ b/textract-pipeline/src/lambda-layer/pypdf2-layer-new/requirements.txt @@ -0,0 +1,2 @@ +PyPDF2 +pycryptodome \ No newline at end of file diff --git a/textract-pipeline/terraform/main.tf b/textract-pipeline/terraform/main.tf index dd8be11..5dd7f9e 100644 --- a/textract-pipeline/terraform/main.tf +++ b/textract-pipeline/terraform/main.tf @@ -192,4 +192,31 @@ resource "aws_iam_role_policy_attachment" "cloudwatch-policy-attach" { resource "aws_iam_role_policy_attachment" "VPC-policy-attach" { role = "${aws_iam_role.lambda_role.name}" policy_arn = "${data.aws_iam_policy.AWSLambdaVPCAccessExecutionRole.arn}" +} + +module "pdf_layer" { + source = "terraform-aws-modules/lambda/aws" + + create_layer = true + + layer_name = "pdfcryptolayer2-terraform" + description = "Fixed PDF layer" + compatible_runtimes = ["python3.12"] + + build_in_docker = true + + source_path = { + path = "../src/lambda-layer/pypdf2-layer-new", + prefix_in_zip = "python" + # npm_requirements = "package.json" + commands = [ + "pip install -r requirements.txt -t .", + ":zip . python" + ], + patterns = [ + "!.*/.*\\.txt", # Skip all txt files recursively + ], + } + + store_on_s3 = false } \ No newline at end of file