Hi Everyone, looks like I am totally lost here. So...
# python
a
Hi Everyone, looks like I am totally lost here. So here is my issue: I created a new Resource (written in python) , something around those lines:
Copy code
class ConnectionArgs(object):
    host: Input[Any]

    def __init__(self, host):
        self.host = host


class CommandArgs(object):
    name: Input[str]
    command: Input[str]

    def __init__(self, name, command):
        self.name = name
        self.command = command

class MyResourceProvider(pulumi.dynamic.ResourceProvider):
    def __init__(self, conn_args: ConnectionArgs):
        super().__init__()
        self._conn_args = conn_args
        
	def configure(self, req: ConfigureRequest):
        super().configure(req)
        # do some other things as pre-reqs

    def create(self, command_args: CommandArgs):
    	# do something
    	dynamic_unique = uuid.uuid4()
    	return CreateResult(id=f"{dynamic_unique}", outs={"ok": True})
class MyResource(pulumi.dynamic.Resource):
	def __init__(self, name: str, conn_args: ConnectionArgs, command_args: CommandArgs, opts=None):
        super().__init__(MyResourceProvider(conn_args), name, vars(command_args), opts)
👀 1
Now in my main file this is happening:
Copy code
for i, az in enumerate(availability_zones.names):
    instance = MyEC2Instance(
        f"test-pulumi-{az}-{i}",
        clusterVPC1.vpc,
        clusterVPC1.private_subnets[i],
        AMIS[aws_config.require("region")]['ubuntu']['24.04']['amd64'],
        instance_type="t2.micro",
        ssh_key=pulumi_test_keypair,
        opts=pulumi.ResourceOptions(depends_on=[clusterVPC1, pulumi_test_keypair]),
    )
   update_instance = MyResource(
        f"update_instance-{i}",
        conn_args=ConnectionArgs(
            host=instance.instance.private_ip,
        ),
        fab_command_args=CommandArgs(
            name=f"command_args-{i}",
            command="whoami",
        ),
        opts=pulumi.ResourceOptions(depends_on=[instance]),
    )
and when running (and or debugging) it fails when initializing the ConnArgs on the host value, with
Copy code
warning: Calling __str__ on an Output[T] is not supported.
But using apply on the
private_ip
also doesn't work.
so what am I doing wrong?
so the public error message is this:
Copy code
error: Exception calling application: 'apply' is not allowed from inside a cloud-callback. Use 'get' to retrieve the value of this Output directly.
which is not really helping.
ok, forget all about it 😉 it looks like it doesn't work with dynamic resource providers...so I need to create my own provider written in Go
🙌 1
✅ 1