ports=[22 , 80 , 443 , 3306]
mysbnet="41.79.199.24/32"
SecurityGroup(self ,"secure1" , name="security1grp" , vpc_id="vpclink" ,
ingress=Sequence[SecurityGroupIngress(
cidr_blocks=Sequence[Token.as_string(mysbnet)] ,
from_port=ports[0],
to_port=ports[0],
protocol="tcp"
),
SecurityGroupIngress(
cidr_blocks=Sequence[Token.as_string("0.0.0.0/0")] ,
from_port=ports[1],
to_port=ports[1],
protocol="tcp"
),
SecurityGroupIngress(
cidr_blocks=Sequence[Token.as_string("0.0.0.0/0")] ,
from_port=ports[2],
to_port=ports[2],
protocol="tcp"
),
SecurityGroupIngress(
cidr_blocks=Sequence[Token.as_string(mysbnet)] ,
from_port=ports[3],
to_port=ports[3],
protocol="tcp"
),
],
egress=Sequence[SecurityGroupEgress(
cidr_blocks=Sequence[Token.as_string("0.0.0.0/0")] ,
from_port=0 ,
to_port=0 ,
protocol="-1"
)]
)
================
this is error
Command output on stderr:
Traceback (most recent call last):
File "C:\Program Files\python3.10.0\lib\typing.py", line 663, in __init__
code = compile(arg, '<string>', 'eval')
File "<string>", line 1
41.79.199.24/32
^^^^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\cdktf-python\projects-python\main.py", line 167, in <module>
MyStack(app, "projects-python")
File "C:\Users\Mohammedbanabila\.virtualenvs\projects-python-M_MdHqee\lib\site-packages\jsii\_runtime.py", line 86, in __call__
inst = super().__call__(*args, **kwargs)
File "E:\cdktf-python\projects-python\main.py", line 116, in __init__
cidr_blocks=Sequence[Token.as_string("41.79.199.24/32")] ,
File "C:\Program Files\python3.10.0\lib\typing.py", line 306, in inner
return cached(*args, **kwds)
File "C:\Program Files\python3.10.0\lib\typing.py", line 1119, in __getitem__
params = tuple(_type_check(p, msg) for p in params)
File "C:\Program Files\python3.10.0\lib\typing.py", line 1119, in <genexpr>
params = tuple(_type_check(p, msg) for p in params)
File "C:\Program Files\python3.10.0\lib\typing.py", line 162, in _type_check
arg = _type_convert(arg, module=module)
return ForwardRef(arg, module=module)
File "C:\Program Files\python3.10.0\lib\typing.py", line 665, in __init__
raise SyntaxError(f"Forward reference must be an expression -- got {arg!r}")
SyntaxError: Forward reference must be an expression -- got '41.79.199.24/32'
⠼ synthesizing…
PS E:\cdktf-python\projects-python> cdktf synth
⠧ synthesizing…
[2021-12-17T02:06:52.957] [ERROR] default - Traceback (most recent call last):
File “C:\Program Files\python3.10.0\lib\typing.py”, line 663, in init
⠇ synthesizing…
[2021-12-17T02:06:52.962] [ERROR] default - code = compile(arg, ‘’, ‘eval’)
File “”, line 1
41.79.199.24/32
^^^^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “E:\cdktf-python\projects-python\main.py”, line 168, in
MyStack(app, “projects-python”)
File “C:\Users\Mohammedbanabila.virtualenvs\projects-python-M_MdHqee\lib\site-packages\jsii_runtime.py”, line 86, in call
inst = super().call(*args, **kwargs)
File “E:\cdktf-python\projects-python\main.py”, line 117, in init
cidr_blocks=Sequence[Token.as_string(mysbnet)] ,
File “C:\Program Files\python3.10.0\lib\typing.py”, line 306, in inner
return cached(*args, **kwds)
File “C:\Program Files\python3.10.0\lib\typing.py”, line 1119, in getitem
params = tuple(_type_check(p, msg) for p in params)
File “C:\Program Files\python3.10.0\lib\typing.py”, line 1119, in
params = tuple(_type_check(p, msg) for p in params)
File “C:\Program Files\python3.10.0\lib\typing.py”, line 162, in _type_check
arg = _type_convert(arg, module=module)
File “C:\Program Files\python3.10.0\lib\typing.py”, line 142, in _type_convert
return ForwardRef(arg, module=module)
File “C:\Program Files\python3.10.0\lib\typing.py”, line 665, in init
raise SyntaxError(f"Forward reference must be an expression – got {arg!r}")
SyntaxError: Forward reference must be an expression – got ‘41.79.199.24/32’
cdktf encountered an error while synthesizing
Synth command: pipenv run python main.py
Error: non-zero exit code 1
Command output on stderr:
Traceback (most recent call last):
File "C:\Program Files\python3.10.0\lib\typing.py", line 663, in __init__
code = compile(arg, '<string>', 'eval')
File "<string>", line 1
41.79.199.24/32
^^^^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\cdktf-python\projects-python\main.py", line 168, in <module>
MyStack(app, "projects-python")
File "C:\Users\Mohammedbanabila\.virtualenvs\projects-python-M_MdHqee\lib\site-packages\jsii\_runtime.py", line 86, in __call__
inst = super().__call__(*args, **kwargs)
File "E:\cdktf-python\projects-python\main.py", line 117, in __init__
cidr_blocks=Sequence[Token.as_string(mysbnet)] ,
File "C:\Program Files\python3.10.0\lib\typing.py", line 306, in inner
return cached(*args, **kwds)
File "C:\Program Files\python3.10.0\lib\typing.py", line 1119, in __getitem__
params = tuple(_type_check(p, msg) for p in params)
File "C:\Program Files\python3.10.0\lib\typing.py", line 1119, in <genexpr>
params = tuple(_type_check(p, msg) for p in params)
File "C:\Program Files\python3.10.0\lib\typing.py", line 162, in _type_check
arg = _type_convert(arg, module=module)
File "C:\Program Files\python3.10.0\lib\typing.py", line 142, in _type_convert
return ForwardRef(arg, module=module)
File "C:\Program Files\python3.10.0\lib\typing.py", line 665, in __init__
raise SyntaxError(f"Forward reference must be an expression -- got {arg!r}")
SyntaxError: Forward reference must be an expression -- got '41.79.199.24/32'