Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCP provider panics when resource creation fails without a valid state #2723

Closed
VenelinMartinov opened this issue Dec 10, 2024 · 1 comment · Fixed by #2730
Closed

GCP provider panics when resource creation fails without a valid state #2723

VenelinMartinov opened this issue Dec 10, 2024 · 1 comment · Fixed by #2730
Assignees
Labels
impact/regression Something that used to work, but is now broken kind/bug Some behavior is incorrect or out of spec p1 A bug severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed

Comments

@VenelinMartinov
Copy link
Contributor

VenelinMartinov commented Dec 10, 2024

Describe what happened

Likely a consequence of pulumi/pulumi-terraform-bridge#2695

Bridge issue: pulumi/pulumi-terraform-bridge#2706

The provider panics when creating a resource fails. Hit this on GCP 8.10.1 with bridge version 3.97.0

    panic: interface conversion: interface {} is nil, not map[string]interface {}
    goroutine 89 [running]:
    github.com/hashicorp/go-cty/cty.Value.GetAttr({{{0x1081fab10?, 0x1400275fa08?}}, {0x0?, 0x0?}}, {0x1068f1b0e, 0x2})
    	/home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/cty/value_ops.go:711 +0x25c
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2.(*v2InstanceState2).ID(0x1400184be60?)
    	/home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/[email protected]/pkg/tfshim/sdk-v2/provider2.go:92 +0x3c
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.(*Provider).Create(0x14000755988, {0x1081fa0b8?, 0x14002341620?}, 0x140072c4e00)
    	/home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/[email protected]/pkg/tfbridge/provider.go:1349 +0x728
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/x/muxer.(*muxer).Create.func1({0x10821bda0?, 0x14000755988?})
    	/home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/[email protected]/pkg/x/muxer/muxer.go:376 +0x3c
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/x/muxer.resourceMethod[...](0x14006032240?, 0x107f4e5c0, 0x14007333698?)
    	/home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/[email protected]/pkg/x/muxer/muxer.go:335 +0xc4
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/x/muxer.(*muxer).Create(0x10cf64b60?, {0x1081fa0b8?, 0x14002341620?}, 0x1076c9600?)
    	/home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/[email protected]/pkg/x/muxer/muxer.go:375 +0x50
    github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Create_Handler.func1({0x1081fa0b8?, 0x14002341620?}, {0x107f213e0?, 0x140072c4e00?})
    	/home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/[email protected]/proto/go/provider_grpc.pb.go:815 +0xd0
    github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc.OpenTracingServerInterceptor.func1({0x1081fa0b8, 0x140023411d0}, {0x107f213e0, 0x140072c4e00}, 0x14007384d60, 0x14007115878)
    	/home/runner/go/pkg/mod/github.com/grpc-ecosystem/[email protected]/go/otgrpc/server.go:57 +0x2d4
    github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Create_Handler({0x108119300, 0x14006032240}, {0x1081fa0b8, 0x140023411d0}, 0x14007386e00, 0x140007a65a0)
    	/home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/[email protected]/proto/go/provider_grpc.pb.go:817 +0x148
    google.golang.org/grpc.(*Server).processUnaryRPC(0x14000d7e200, {0x1081fa0b8, 0x14002341140}, {0x108211660, 0x14005ec9380}, 0x140074bcd80, 0x14001de4510, 0x10cfcd8b8, 0x0)
    	/home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1394 +0xb64
    google.golang.org/grpc.(*Server).handleStream(0x14000d7e200, {0x108211660, 0x14005ec9380}, 0x140074bcd80)
    	/home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1805 +0xb20
    google.golang.org/grpc.(*Server).serveStreams.func2.1()
    	/home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1029 +0x84
    created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 16
    	/home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1040 +0x13c

Sample program

import pulumi
import pulumi_gcp as gcp

# Get configuration values
config = pulumi.Config()
namespace = "ns"
environment = "env"
name = "name"

# Create the base resource name
resource_name = f"{namespace}-{environment}-{name}"

# Create a first GKE cluster as usual
cluster1 = gcp.container.Cluster(
    f"{resource_name}-3",
    description="GKE Cluster for testing Pulumi failure mode",
    initial_node_count=2,
    min_master_version="1.30.5-gke.1014003",
    location="us-east1-b",
    node_config=gcp.container.ClusterNodeConfigArgs(
        machine_type="e2-micro",
        oauth_scopes=[
            "https://www.googleapis.com/auth/cloud-platform",
        ],
    ),
    private_cluster_config={
        "enable_private_nodes": True,
        "master_global_access_config": {
            "enabled": True,
        },
        "master_ipv4_cidr_block": "172.16.0.0/28",
    },
    deletion_protection=False,
)

# Create a second GKE cluster with IP range conflict to trigger failure mode
cluster2 = gcp.container.Cluster(
    f"{resource_name}-4",
    description="GKE Cluster for testing Pulumi failure mode",
    initial_node_count=2,
    min_master_version="1.30.5-gke.1014003",
    location="us-east1-b",
    node_config=gcp.container.ClusterNodeConfigArgs(
        machine_type="e2-micro",
        oauth_scopes=[
            "https://www.googleapis.com/auth/cloud-platform",
        ],
    ),
    private_cluster_config={
        "enable_private_nodes": True,
        "master_global_access_config": {
            "enabled": True,
        },
        "master_ipv4_cidr_block": "172.16.0.0/28",  # Intentionally create IP range conflict - Comment out to attempt repair after failure
        # "master_ipv4_cidr_block": "172.16.0.16/28",  # Fix CIDR range to repair conflict - Uncomment to attempt to repair after failure
    },
    deletion_protection=False,
    # Force dependency to ensure that first cluster is up and running for conflict to occur
    opts=pulumi.ResourceOptions(depends_on=[cluster1]),
)


# Export the cluster endpoint and kubeconfig
pulumi.export("endpoint_1", cluster1.endpoint)
pulumi.export("endpoint_2", cluster2.endpoint)

failed with

):
    error:   sdk-v2/provider2.go:512: sdk.helper_schema: googleapi: Error 400: Master version must be one of "STABLE" channel supported versions [1.28.14-gke.1340000, 1.28.15-gke.1020000, 1.29.9-gke.1496000, 1.29.10-gke.1054000, 1.30.5-gke.1443001, 1.30.5-gke.1699000].
    Details:
    [
      {
        "@type": "type.googleapis.com/google.rpc.RequestInfo",
        "requestId": "0xeba588665e5284dc"
      }
    ]
    , badRequest: [email protected]

which seems to trigger the panic

Log output

No response

Affected Resource(s)

No response

Output of pulumi about

.

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@VenelinMartinov VenelinMartinov added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team impact/regression Something that used to work, but is now broken p1 A bug severe enough to be the next item assigned to an engineer and removed needs-triage Needs attention from the triage team labels Dec 10, 2024
@pulumi-bot pulumi-bot self-assigned this Dec 10, 2024
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Dec 10, 2024
@pulumi-bot
Copy link
Contributor

This issue has been addressed in PR #2730 and shipped in release v8.10.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/regression Something that used to work, but is now broken kind/bug Some behavior is incorrect or out of spec p1 A bug severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed
Projects
None yet
2 participants