cloudtools / troposphere

troposphere - Python library to create AWS CloudFormation descriptions
BSD 2-Clause "Simplified" License
4.93k stars 1.45k forks source link

When using ec2.VpnTunnelOptionsSpecification, report error:compile() missing required argument 'filename' (pos 2) #2155

Closed bybywudi closed 1 year ago

bybywudi commented 1 year ago

I am using troposphere version 4.3.2 The issue occurs in this code section:

  vpn_tunnel_option_props = self.filter_parameters(
      vpn_option.items(), ec2.VpnTunnelOptionsSpecification
  )

after I ran it an error occured: compile() missing required argument 'filename' (pos 2) But it works in troposphere version 3.2.2 I find that troposphere uses re.complile() in the old versions(v3), but the Python system function compile() is used in the new versions(v4), which caused this problem. Is this a bug?

def vpn_tunnel_inside_cidr(cidr):
    """
    Property: VpnTunnelOptionsSpecification.TunnelInsideCidr
    """
    cidr_match_re = compile(
        r"^169\.254\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?)"
        r"\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\/30$"
    )