Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serverless.Api refuses ResourcePolicy in Auth property #1525

Closed
nielslaukens opened this issue Nov 22, 2019 · 2 comments
Closed

serverless.Api refuses ResourcePolicy in Auth property #1525

nielslaukens opened this issue Nov 22, 2019 · 2 comments

Comments

@nielslaukens
Copy link
Contributor

@nielslaukens nielslaukens commented Nov 22, 2019

Hi,

Thank you for the time and effort you are putting in to Troposphere. I really appreciate it!

I'm trying to use Troposphere to create an API gateway via Serverless with a ResourcePolicy.

Minimal troposphere code to reproduce the issue
from troposphere import Template, serverless

template = Template()
template.set_transform('AWS::Serverless-2016-10-31')

api_gateway = template.add_resource(serverless.Api(
    "ApiGateway",
    StageName="Prod",
    EndpointConfiguration="PRIVATE",
    Auth=serverless.Auth(
        ResourcePolicy={
            'SourceVpcWhitelist': [
                'vpc-12345678',
            ],
        },
    ),
))

print(template.to_json())

Troposphere fails to accept ResourcePolicy as attribute in the Auth() object:

Auth object does not support attribute ResourcePolicy

This usage is covered in the AWS documentation. I've also verified it to work by manually editing the JSON. The problem seems to be with the class definition of the Auth class. This is already hinted in #1278 :

The Auth settings are a bit wonky.

I'll look in to fixing this myself and creating a Pull Request as follow up.

System details macOS 10.14.6
$ python -V
Python 3.7.5
$ pip list
Package                       Version     
----------------------------- ------------
attrs                         19.3.0      
awacs                         0.9.6       
aws-cloudformation-utils      0.1.0       
aws-cloudformation-validation 1.0.1       
boto3                         1.10.22     
botocore                      1.13.22     
botostubs                     0.11.1.10.20
central-helpers               5.11.0      
certifi                       2019.9.11   
cffi                          1.13.2      
cfn-flip                      1.2.2       
cfnresponse                   1.0.2       
chardet                       3.0.4       
Click                         7.0         
cryptography                  2.8         
custom-resources              0.7.0       
docutils                      0.15.2      
edgegrid-python               1.1.1       
entrypoints                   0.3         
enum34                        1.1.6       
flake8                        3.7.9       
flake8-builtins               1.4.1       
flake8-commas                 2.0.0       
flake8-docstrings             1.5.0       
flake8-pep3101                1.2.1       
flake8-string-format          0.2.3       
flake8-tidy-imports           3.1.0       
idna                          2.8         
importlib-metadata            0.23        
invoke                        1.3.0       
ipaddress                     1.0.23      
jmespath                      0.9.4       
mccabe                        0.6.1       
more-itertools                7.2.0       
ndg-httpsclient               0.5.1       
netaddr                       0.7.19      
pip                           19.0.3      
prometheus-client             0.7.1       
pyasn1                        0.4.8       
pycodestyle                   2.5.0       
pycparser                     2.19        
pydocstyle                    4.0.1       
pyflakes                      2.1.1       
pyminifier                    2.1         
pyOpenSSL                     19.1.0      
python-dateutil               2.8.0       
PyYAML                        5.1.2       
pyzabbix                      0.7.5       
requests                      2.22.0      
s3transfer                    0.2.1       
setuptools                    40.8.0      
six                           1.13.0      
snowballstemmer               2.0.0       
troposphere                   2.5.2       
urllib3                       1.25.7      
zipp                          0.6.0       
@benbridts
Copy link
Contributor

@benbridts benbridts commented Mar 2, 2020

Solved in #1568

@markpeek
Copy link
Member

@markpeek markpeek commented Mar 2, 2020

Closing. Thanks @ikben.

@markpeek markpeek closed this Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.