aws-cloudformation / cloudformation-cli-python-plugin

The CloudFormation Provider Development Toolkit Python Plugin allows you to autogenerate Python code based on an input schema.
Apache License 2.0
108 stars 45 forks source link

New python cryptography causes contract tests to fail #253

Closed mmaeng closed 1 year ago

mmaeng commented 1 year ago

Cryptography v 40.0.0 looks to cause cfn test to fail contract testing. Looks like a function has been deprecated.

local sam output

Invoking awssamples_ec2_importkeypair.handlers.resource (python3.7)
Skip pulling image and use local one: public.ecr.aws/sam/emulation-python3.7:rapid-1.59.0-x86_64.

Mounting /local/home/xxxxx/3p_debug/new_resource/aws-cloudformation-samples/resource-types/awssamples-ec2-importkeypair/python/build as /var/task:ro,delegated inside runtime container
START RequestId: ebda989b-3011-498b-82e0-73a8071a9efe Version: $LATEST
Traceback (most recent call last): Unable to import module 'awssamples_ec2_importkeypair.handlers': cannot import name 'verify_interface' from 'cryptography.utils' (/var/task/cryptography/utils.py)

Workshop used is https://github.com/aws-cloudformation/aws-cloudformation-samples/tree/main/resource-types/awssamples-ec2-importkeypair/python

adding cryptography<40.0.0 to requirements.txt file in the workshop resolves the issue. https://github.com/aws-cloudformation/aws-cloudformation-samples/blob/main/resource-types/awssamples-ec2-importkeypair/python/requirements.txt