elegant-smartphone-60282
08/21/2022, 12:27 PMerror: Program failed with an unhandled exception:
Traceback (most recent call last):
File "/opt/homebrew/bin/pulumi-language-python-exec", line 111, in <module>
loop.run_until_complete(coro)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
return future.result()
File "/Users/afeefaz/Downloads/iac/pulumi/venv/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 126, in run_in_stack
await run_pulumi_func(lambda: Stack(func))
File "/Users/afeefaz/Downloads/iac/pulumi/venv/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 51, in run_pulumi_func
await wait_for_rpcs()
File "/Users/afeefaz/Downloads/iac/pulumi/venv/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 73, in wait_for_rpcs
await RPC_MANAGER.rpcs.pop()
File "/Users/afeefaz/Downloads/iac/pulumi/venv/lib/python3.10/site-packages/pulumi/runtime/rpc_manager.py", line 68, in rpc_wrapper
result = await rpc
File "/Users/afeefaz/Downloads/iac/pulumi/venv/lib/python3.10/site-packages/pulumi/output.py", line 98, in is_value_known
return await is_known and not contains_unknowns(await future)
File "/Users/afeefaz/Downloads/iac/pulumi/venv/lib/python3.10/site-packages/pulumi/output.py", line 98, in is_value_known
return await is_known and not contains_unknowns(await future)
File "/Users/afeefaz/Downloads/iac/pulumi/venv/lib/python3.10/site-packages/pulumi/output.py", line 98, in is_value_known
return await is_known and not contains_unknowns(await future)
[Previous line repeated 10 more times]
File "/Users/afeefaz/Downloads/iac/pulumi/venv/lib/python3.10/site-packages/pulumi/runtime/resource.py", line 561, in do_register
req = resource_pb2.RegisterResourceRequest(
TypeError: bad argument type for built-in operation
Here’s the python code :
# check for SG existence
try:
existing_sg = aws.ec2.get_security_group(name="sg_name", vpc_id=vpc_id)
except:
print("Creating new SG")
created_sg = aws.ec2.SecurityGroup("sg_name",
name="sg_name",
vpc_id=vpc_id,
egress=[{
'from_port': 0,
'to_port': 0,
'protocol': "-1",
'cidr_blocks': ['0.0.0.0/0']
}],
ingress=[{
'from_port': 0,
'to_port': 0,
'protocol': "-1",
'cidr_blocks': ['0.0.0.0/0']
}],
tags={
"Name":"sg_name"
}
)
pulumi.export("sg_name", created_sg.id)
else:
aws.ec2.SecurityGroup("sg_name",
opts=pulumi.ResourceOptions(
import_=[existing_sg.id]
)
)
billowy-army-68599
08/22/2022, 12:02 AMprehistoric-book-85014
08/25/2022, 9:48 AMambitious-father-68746
08/25/2022, 10:42 AM