pulumiverse / pulumi-cockroach

Pulumi provider for Cockroach DB
Apache License 2.0
7 stars 3 forks source link

Can't create cluster #44

Open plainspoken-chris opened 2 months ago

plainspoken-chris commented 2 months ago
"""Stand up the infrastructure for the application."""

import pulumi
import pulumiverse_cockroach as cockroach

project = pulumi.get_project()
p = project + "-"

cockroach_cluster = cockroach.Cluster(
    resource_name=p+"cockroach-cluster",
    name=p+"cockroach-cluster",
    cloud_provider="AWS",
    regions=[cockroach.ClusterRegionArgs(
        name="us-east-1",
        # node_count=0,
        # primary=True,
    )],
    # parent_id="root",
    # cockroach_version="24.1",
    serverless=cockroach.ClusterServerlessArgs(
        spend_limit=0,
    )
    )

pulumi.export("cluster_id", cockroach_cluster.id)

Results in

2024/08/30 20:15:06 [DEBUG] Waiting for state to become: [success] 2024/08/30 20:15:07 [TRACE] Waiting 500ms before next try 2024/08/30 20:15:07 [TRACE] Waiting 1s before next try panic: fatal: An assertion has failed: Resource state did not contain an 'id' property. This is an error in the provider. Special identity handling may be needed. Consider setting ResourceInfo.ComputeID for the cockroach_cluster resource goroutine 38 [running]: github.com/pulumi/pulumi/sdk/v3/go/common/util/contract.failfast(...) /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.116.1/go/common/util/contract/failfast.go:23 github.com/pulumi/pulumi/sdk/v3/go/common/util/contract.Assertf(0x0?, {0x10181701b?, 0x1017d3ccb?}, {0x14000673258?, 0x1?, 0x1400013b590?}) /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.116.1/go/common/util/contract/assert.go:35 +0xe0 github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge.extractID({0x101d77fa8?, 0x1400013aa50?}, {0x1017e5062?, 0x140006c3ea0?}, 0x0?, 0x0?) /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/pf@v0.36.0/tfbridge/ids.go:41 +0x104 github.com/pulumi/pulumi-terraform-bridge/pf/tfbridge.(provider).CreateWithContext(0x1400001ee00, {0x101d77fa8?, 0x1400013a570?}, {0x1400004a230, 0x63}, 0x0?, 0x0?, 0x0) /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/pf@v0.36.0/tfbridge/provider_create.go:126 +0x5e4 github.com/pulumi/pulumi-terraform-bridge/pf/internal/plugin.(providerServer).Create(0x1400017c330, {0x101d77fa8, 0x1400013a570}, 0x140001feb90) /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/pf@v0.36.0/internal/plugin/provider_server.go:351 +0x12c github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Create_Handler.func1({0x101d77fa8, 0x1400013a570}, {0x101c93ba0?, 0x140001feb90}) /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.116.1/proto/go/provider_grpc.pb.go:593 +0x74 github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc.OpenTracingServerInterceptor.func1({0x101d77fa8, 0x1400013a1b0}, {0x101c93ba0, 0x140001feb90}, 0x1400003ae20, 0x14000226648) /home/runner/go/pkg/mod/github.com/grpc-ecosystem/grpc-opentracing@v0.0.0-20180507213350-8e809c8a8645/go/otgrpc/server.go:57 +0x2e8 github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Create_Handler({0x101d24500?, 0x1400017c330}, {0x101d77fa8, 0x1400013a1b0}, 0x140003f4a00, 0x1400025e460) /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.116.1/proto/go/provider_grpc.pb.go:595 +0x12c google.golang.org/grpc.(Server).processUnaryRPC(0x14000276400, {0x101d77fa8, 0x1400013a120}, {0x101d82520, 0x140000fe480}, 0x140004098c0, 0x1400017c3c0, 0x10270dfa0, 0x0) /home/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1369 +0xba0 google.golang.org/grpc.(Server).handleStream(0x14000276400, {0x101d82520, 0x140000fe480}, 0x140004098c0) /home/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1780 +0xc80 google.golang.org/grpc.(Server).serveStreams.func2.1() /home/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1019 +0x8c created by google.golang.org/grpc.(Server).serveStreams.func2 in goroutine 61 /home/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1030 +0x150

error: update failed
adinhodovic commented 1 week ago

Did you manage to resolve this?

ringods commented 1 week ago

@plainspoken-chris could you retry with provider version v0.4.0 or up?

adinhodovic commented 1 week ago

@plainspoken-chris could you retry with provider version v0.4.0 or up?

Same error:

    2024/10/31 21:05:34 [TRACE] Waiting 10s before next try
    2024/10/31 21:05:44 [TRACE] Waiting 10s before next try
    2024/10/31 21:05:55 [TRACE] Waiting 10s before next try
    2024/10/31 21:06:05 [TRACE] Waiting 10s before next try
    2024/10/31 21:06:16 [TRACE] Waiting 10s before next try
    2024/10/31 21:06:26 [TRACE] Waiting 10s before next try
    2024/10/31 21:06:36 [TRACE] Waiting 10s before next try

    error: update failed

  cockroach:index:Cluster (clusterResource):
    error: Could not find required property 'id' in state. This is an error in cockroach resource provider, please report at https://github.com/pulumiverse/pulumi-cockroach
ringods commented 1 week ago

@adinhodovic would it be possible to generate a log file for me?

Instructions can be found here: https://www.pulumi.com/docs/iac/support/troubleshooting/#verbose-logging

So do max level 10 (not including secrets) and given this is a TF bridged provider, set TF_LOG to TRACE as in the docs example above.

ringods commented 1 week ago

@adinhodovic I changed something in the mapping of the Cluster resource from the underlying TF provider:

https://github.com/pulumiverse/pulumi-cockroach/commit/de88ea497eeba4f5d1245134f1df240e995d4548#diff-34c57e622183cb0d8dd0d3f9eaa0861b3340120e9b2ad811bac7ac7be4cea4b1

I accidentally remapped the id to clusterId for the Cluster resource itself. While this is required for resources taking a cluster ID as an input, it prevented the Cluster resource to expose its own ID as a proper output.

Included in release v0.6.0. https://github.com/pulumiverse/pulumi-cockroach/releases/tag/v0.6.0

Can you retest with this version?

adinhodovic commented 1 week ago

@adinhodovic I changed something in the mapping of the Cluster resource from the underlying TF provider:

de88ea4#diff-34c57e622183cb0d8dd0d3f9eaa0861b3340120e9b2ad811bac7ac7be4cea4b1

I accidentally remapped the id to clusterId for the Cluster resource itself. While this is required for resources taking a cluster ID as an input, it prevented the Cluster resource to expose its own ID as a proper output.

Included in release v0.6.0. https://github.com/pulumiverse/pulumi-cockroach/releases/tag/v0.6.0

Can you retest with this version?

That worked. Thanks!

However, need the same fix for the Prometheus config resource. Also, ran with debug logs if needed.

   provider/metric_export_prometheus_config_resource.go:140: provider: enable prometheus metric export response: {
  "cluster_id": "redacted",
  "status": "ENABLED",
  "targets": {
    "us-east-1": "redacted"
  },
  "user_message": "This integration is active."
}: provider=cockroach@0.6.0
error: Could not find required property 'id' in state. This is an error in cockroach resource provider, please report at https://github.com/pulumiverse/pulumi-cockroach
error: update failed
adinhodovic commented 2 days ago

Does #51 fix this for remainder of resources?