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

nutritious-fireman-41151

02/23/2020, 5:34 AM
Hi All, I am trying to create Dynamic Provider and on executing it via 'Pulumi up' command, I am getting an error"
pulumi-python:dynamic:Resource :
error: Exception calling application: There is no current event loop in thread 'ThreadPoolExecutor-0_0'.
w

white-balloon-205

02/23/2020, 7:53 AM
Could you share a snippet of your dynamic provider? I haven’t seen that error before.
n

nutritious-fireman-41151

02/23/2020, 8:12 AM
Copy code
import pulumi_okta as okta
from pulumi import ResourceOptions, ComponentResource, Input, CustomResource, Output
from pulumi.dynamic import ResourceProvider, CreateResult, Resource

from config import *



class OktaSetupArgs(object):

    def __init__(
            self,
            iam_saml_provider_arn: str = None,
            iam_role_urn: str = None
    ):

        self.iam_saml_provider_arn = iam_saml_provider_arn
        self.iam_role_urn = iam_role_urn


class OktaProvider(ResourceProvider):
    """
    Custom Provider for Okta
    """

    def create(self, props):
        okta_aws_app = okta.app.Saml(OKTA_AWS_OIN_APP_RES_NAME,
                                     label=OKTA_AWS_OIN_APP_NAME,
                                     preconfigured_app='amazon_aws',
                                     subject_name_id_format='urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'
                                     )

        okta_app_id = okta_aws_app.id.apply(lambda id: f"{id}")
        okta_metadata = okta_aws_app.metadata.apply(lambda metadata: metadata)

        return CreateResult(id_=OKTA_AWS_OIN_APP_RES_NAME, outs={okta_metadata})


class OktaSetup(Resource):
    okta_metadata: str

    def __init__(self, name: str, args: OktaSetupArgs, opts: ResourceOptions = None):

        full_args = {'okta_metadata': None, **vars(args)}

        super().__init__(OktaProvider(), name, full_args, opts)
And then I am doing :
pulumi up
I have also set:
set PULUMI_TEST_MODE=true
to make it run, else it was giving me an error: `error: Exception calling application: Program run without the Pulumi engine available; re-run using the
pulumi
CLI`
w

white-balloon-205

02/23/2020, 6:00 PM
Ahh -
PULUMI_TEST_MODE
may be the cause of the problem! Does it work if you don’t have that set? Could you open an issue in github perhaps so we can take a deeper look?
45 Views