hallowed-room-5599
02/27/2023, 1:03 PMgcloud
but I'm lost and can't find much examples.
With the code below I get error: unrecognized resource type (Check): gcp:myaccount:Cluster
class MyCluster(pulumi.CustomResource):
def __init__(self, name, opts=None):
super().__init__("gcp:myaccount:Cluster", name, {}, opts)
def create(self):
# TODO: Call gcloud directly to create cluster
super().create()
def delete(self):
# TODO: Call gcloud directly to kill cluster
super().delete()
cluster = MyCluster("mycluster")
What is *:**:**
supposed to be?echoing-dinner-19531
02/27/2023, 3:13 PMCustomResource
, they are specific to providers. "gpc:myaccount:Cluster" tells the engine this is a resource from the "gcp" provider called "myaccount:Cluster". The gcp provider doesn't define that resource so you get an unrecognized resource type error.hallowed-room-5599
02/27/2023, 3:16 PMgcloud
. So what is the suggested approach? I'm on a GKE trial period so can't be waiting for Pulumi to maybe or maybe not implement the missing gcloud flagechoing-dinner-19531
02/27/2023, 3:16 PMhallowed-room-5599
02/27/2023, 4:34 PMcluster.name
below without adding GkeClusterArgs and a bunch of unnecessary boilerplate?
class GkeClusterProvider(ResourceProvider):
def create(self, inputs):
cluster_name = inputs["name"] + "-" + str(uuid.uuid4())[:8]
return CreateResult(id_=cluster_name, outs={
"name": cluster_name,
})
class GkeCluster(Resource):
name: pulumi.Output[str]
def __init__(self, name, props=None, opts=None):
props = props or {}
super().__init__(GkeClusterProvider(), name, {}, opts)
cluster = GkeCluster("cluster-staging")
pulumi.export("myresource", cluster.name)
echoing-dinner-19531
02/27/2023, 5:46 PM