question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

invoking add_ingress_rule() on an imported security group throws AttributeError: 'Resource' object has no attribute 'add_ingress_rule'

See original GitHub issue

After upgrading CDK to v1.16.x and jsii to 0.20.3 today, add_ingress_rule() suddenly started throwing the below error when trying to add an inbound rule to an imported security group.

AttributeError: ‘Resource’ object has no attribute ‘add_ingress_rule’

Reproduction Steps

self._lambda_security_group = ec2.SecurityGroup.from_security_group_id(
    self,
    'sg1',
    security_group_id='sg-xxxx'
)

self._lambda_security_group.add_ingress_rule(
    ec2.Peer().prefix_list('sg-xxxx'),
    ec2.Port.tcp(443),
    description="Sample Ingress rule"
)

Error Log

Traceback (most recent call last):
  File "app.py", line 30, in <module>
    env=core.Environment(account=ES_DOMAIN_ARN.split(":")[4], region=ES_DOMAIN_ARN.split(":")[3])
  File "/Users/aravraje/aws-solutions/aws-es-recommended-cw-alarms/.env/lib/python3.7/site-packages/jsii/_runtime.py", line 66, in __call__
    inst = super().__call__(*args, **kwargs)
  File "/Users/aravraje/aws-solutions/aws-es-recommended-cw-alarms/aws_es_recommended_cw_alarms/aws_es_recommended_cw_alarms_stack.py", line 23, in __init__
    self, "aws-es-cw-alarms", domain_arn, aws_cli_profile, cw_trigger_sns_arn_list, enable_es_api_output, es_api_output_sns_arn
  File "/Users/aravraje/aws-solutions/aws-es-recommended-cw-alarms/.env/lib/python3.7/site-packages/jsii/_runtime.py", line 66, in __call__
    inst = super().__call__(*args, **kwargs)
  File "/Users/aravraje/aws-solutions/aws-es-recommended-cw-alarms/aws_es_recommended_cw_alarms/aws_es_cw_alarms.py", line 220, in __init__
    self._lambda_security_group.add_ingress_rule(
AttributeError: 'Resource' object has no attribute 'add_ingress_rule'

Environment

  • CLI Version : 1.16.1 (build 9a5a761)
  • Framework Version:
  • OS : macOS Sierra
  • Language : Python

Other


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
johns1342commented, Nov 13, 2019

This appears to be fixed for me using aws-cdk 1.16.2 and jsii 0.20.5.

0reactions
skinny85commented, Nov 13, 2019

@tarunaroraonline I don’t think that’s the same error…

2019-11-13T18:03:06.1568518Z   Error: 'ConnectorsECSStack' object has no attribute 'ref'
Read more comments on GitHub >

github_iconTop Results From Across the Web

Add Ingress Rule to Security Groups using AWS CDK
aws_ec2. However - when I try to deploy the stack, I get the following error : AttributeError: 'method' object has no attribute 'jsii__ ......
Read more >
awslabs/aws-cdk - Gitter
I am looking for CI/CD setup for aws-cdk python project. I have api gateway + lambda functions + dynamodb and I am trying...
Read more >
'Resource' object has no attribute 'urlcrawlerrorscounts'
Google Search Console - 'Resource' object has no attribute 'urlcrawlerrorscounts'. I am trying to use the googleapiclient library for python with my ...
Read more >
Amazon EC2 - AWS Documentation
No information is available for this page.
Read more >
RQs answer (3) - Zenodo
The pool does not exist or has not been authorized for use. ... Invalid attribute type error when trying to validate an object...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found