https://pulumi.com logo
#general
Title
# general
f

future-daybreak-16512

12/07/2021, 9:35 AM
I've posted the question on #python channel originally, for greater reach posting the same here : Getting the following error while calling get functions from Pulumi Policy class using Python :
Copy code
error: Exception calling application: There is no current event loop in thread 'ThreadPoolExecutor-0_0'.
The sample code :
Copy code
from pprint import pprint
from pulumi_policy import (
  ReportViolation,
  ResourceValidationArgs,
)
import pulumi
import pulumi_aws as aws

config = pulumi.Config()

def ec2_validator(args: ResourceValidationArgs, report_violation: ReportViolation):

  if args.resource_type == "aws:ec2/instance:Instance":
    if args.props.get('vpcSecurityGroupIds'): 
      sg_id = aws.ec2.get_security_groups(tags={
        "key": "val",
        "key": "val",
      })

      pprint(vars(sg_id))
Any idea how to fix this error?