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

big-insurance-83351

08/22/2023, 7:06 AM
HI, I need a help regarding following exception :
Copy code
error: Program failed with an unhandled exception:
    Traceback (most recent call last):
      File "/opt/homebrew/bin/pulumi-language-python-exec", line 197, in <module>
        loop.run_until_complete(coro)
      File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
        return future.result()
               ^^^^^^^^^^^^^^^
      File "/Users/ershad/opt/projects/be/bcs-base/venv/lib/python3.11/site-packages/pulumi/runtime/stack.py", line 137, in run_in_stack
        await run_pulumi_func(lambda: Stack(func))
      File "/Users/ershad/opt/projects/be/bcs-base/venv/lib/python3.11/site-packages/pulumi/runtime/stack.py", line 51, in run_pulumi_func
        await wait_for_rpcs()
      File "/Users/ershad/opt/projects/be/bcs-base/venv/lib/python3.11/site-packages/pulumi/runtime/stack.py", line 121, in wait_for_rpcs
        raise exception
      File "/Users/ershad/opt/projects/be/bcs-base/venv/lib/python3.11/site-packages/pulumi/output.py", line 172, in run
        is_known = await self._is_known
                   ^^^^^^^^^^^^^^^^^^^^
      File "/Users/ershad/opt/projects/be/bcs-base/venv/lib/python3.11/site-packages/pulumi/output.py", line 103, in is_value_known
        return await is_known and not contains_unknowns(await future)
               ^^^^^^^^^^^^^^
      File "/Users/ershad/opt/projects/be/bcs-base/venv/lib/python3.11/site-packages/pulumi/runtime/resource.py", line 872, in do_register
        resolver = await prepare_resource(res, ty, custom, remote, props, opts, typ)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/ershad/opt/projects/be/bcs-base/venv/lib/python3.11/site-packages/pulumi/runtime/resource.py", line 176, in prepare_resource
        serialized_props = await rpc.serialize_properties(
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/ershad/opt/projects/be/bcs-base/venv/lib/python3.11/site-packages/pulumi/runtime/rpc.py", line 209, in serialize_properties
        result = await serialize_property(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/ershad/opt/projects/be/bcs-base/venv/lib/python3.11/site-packages/pulumi/runtime/rpc.py", line 562, in serialize_property
        raise ValueError(f"unexpected input of type {type(value).__name__}")
    ValueError: unexpected input of type Subnets
b

billowy-army-68599

08/22/2023, 2:03 PM
We’d need to see your code really
b

big-insurance-83351

08/23/2023, 1:17 AM
Yes sure, will share shortly
the code:
Copy code
def create_cluster(self):
        conf = self.config.get_object('gke')['cluster']
        # Create a GCP resource (GKE Cluster)
        return container.Cluster(
            conf['resource-name'],
            name=conf['name'],
            initial_node_count=conf['node_count'],
            network=self.network,
            subnetwork=self.subnet.id,
            # master_auth=container.ClusterMasterAuthArgs(
                
            #     username=conf['username'],
            #     password=conf['password']
            # ),
            logging_service="<http://logging.googleapis.com/kubernetes|logging.googleapis.com/kubernetes>",
            monitoring_service="<http://monitoring.googleapis.com/kubernetes|monitoring.googleapis.com/kubernetes>",
            node_config=container.ClusterNodeConfigArgs(
                oauth_scopes=conf['oauth_scopes'],
                machine_type=conf['node_machine_type'],
            ),
            node_version=conf['node_version'],
            remove_default_node_pool=True,
            location=conf['location'],
            private_cluster_config=container.ClusterPrivateClusterConfigArgs(
                enable_private_endpoint=True,
                enable_private_nodes=True
            ),
            enable_autopilot=False,
            cluster_telemetry=container.ClusterClusterTelemetryArgs(
                type='ENABLED'
            )
        )
I was using the existing network & subnet. Following code return the existing subnet:
Copy code
from pulumi_gcp import compute

class Subnet:

    def __init__(self, subnet_name, subnet_id) -> None:
        self.subnet_name = subnet_name
        self.subnet_id = subnet_id

    # Get existing sub network
    def get_subnet_instance(self):
        return compute.Subnetwork.get(self.subnet_name, self.subnet_id)
Hi, this has been resolved.