acoustic-father-565
09/03/2025, 12:49 PMclass 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)
acoustic-father-565
09/03/2025, 12:53 PMfor 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
warning: Calling __str__ on an Output[T] is not supported.
But using apply on the private_ip
also doesn't work.acoustic-father-565
09/03/2025, 12:54 PMacoustic-father-565
09/03/2025, 1:06 PMerror: 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.acoustic-father-565
09/03/2025, 1:51 PM