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

Network panics: can't convert "x86" to cty.Value #575

Open
eBeyond opened this issue Aug 7, 2024 · 11 comments
Open

Network panics: can't convert "x86" to cty.Value #575

eBeyond opened this issue Aug 7, 2024 · 11 comments
Labels
awaiting/bridge The issue cannot be resolved without action in pulumi-terraform-bridge. awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). impact/panic This bug represents a panic or unexpected crash kind/bug Some behavior is incorrect or out of spec

Comments

@eBeyond
Copy link

eBeyond commented Aug 7, 2024

Describe what happened

I've got a Network configuration like this:

    networks[definitions.STAGE_DEV] = hcloud.Network(definitions.STAGE_DEV,
                         ip_range="10.10.1.0/24",
                         name=definitions.STAGE_DEV,
                         opts=pulumi.ResourceOptions(protect=True))

This was working some time ago. But now (after an update) it failed:

Diagnostics:
  hcloud:index:Network (core):
    error: error reading from server: EOF

  pulumi:pulumi:Stack (sys-main):
    panic: can't convert "x86" to cty.Value
    goroutine 99 [running]:
    github.com/hashicorp/terraform-plugin-sdk/v2/internal/configs/hcl2shim.HCL2ValueFromConfigValue({0x1018317c0?, 0x101af3bf0?})
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/[email protected]/internal/configs/hcl2shim/values.go:231 +0x31c
    github.com/hashicorp/terraform-plugin-sdk/v2/internal/configs/hcl2shim.HCL2ValueFromConfigValue({0x1018b5de0?, 0x1400018dad0?})
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/[email protected]/internal/configs/hcl2shim/values.go:225 +0x354
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.HCL2ValueFromConfigValue(...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/[email protected]/helper/schema/exports.go:15
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2.makeResourceRawConfigClassic(0x14000753288?, 0x1018b5de0?)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/[email protected]/pkg/tfshim/sdk-v2/cty.go:57 +0x34
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2.makeResourceRawConfig(0x140003b2460, 0x140000ee960?)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/[email protected]/pkg/tfshim/sdk-v2/cty.go:50 +0xf4
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2.v2Provider.ReadDataDiff({0x1400007f920?, {0x140001992a8?, 0x0?, 0xffffffffffffffff?}}, {0x101b07ba8, 0x140005a58f0}, {0x1014f636b, 0xc}, {0x101af8080?, 0x140003b2460})
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/[email protected]/pkg/tfshim/sdk-v2/provider.go:171 +0x9c
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.(*Provider).Invoke(0x14000145980, {0x101b07ba8?, 0x14000883170?}, 0x1400082a580)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/[email protected]/pkg/tfbridge/provider.go:1695 +0x894
    github.com/pulumi/pulumi-terraform-bridge/x/muxer.(*muxer).Invoke(0x1400038d920, {0x101b07ba8, 0x14000883170}, 0x1400082a580)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/x/[email protected]/muxer.go:342 +0x120
    github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Invoke_Handler.func1({0x101b07ba8, 0x14000883170}, {0x1019daca0?, 0x1400082a580})
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/[email protected]/proto/go/provider_grpc.pb.go:558 +0x74
    github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc.OpenTracingServerInterceptor.func1({0x101b07ba8, 0x14000882f00}, {0x1019daca0, 0x1400082a580}, 0x140001d43e0, 0x1400067a2d0)
        /home/runner/go/pkg/mod/github.com/grpc-ecosystem/[email protected]/go/otgrpc/server.go:57 +0x2e8
    github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Invoke_Handler({0x101ab3c80?, 0x1400038d920}, {0x101b07ba8, 0x14000882f00}, 0x1400082c980, 0x140003da140)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/[email protected]/proto/go/provider_grpc.pb.go:560 +0x12c
    google.golang.org/grpc.(*Server).processUnaryRPC(0x1400071e000, {0x101b07ba8, 0x14000882e40}, {0x101b12dc0, 0x1400025ea80}, 0x1400064aea0, 0x140008298f0, 0x102597118, 0x0)
        /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1369 +0xba0
    google.golang.org/grpc.(*Server).handleStream(0x1400071e000, {0x101b12dc0, 0x1400025ea80}, 0x1400064aea0)
        /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1780 +0xc80
    google.golang.org/grpc.(*Server).serveStreams.func2.1()
        /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1019 +0x8c
    created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 55
        /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1030 +0x150


Sample program

    networks[definitions.STAGE_DEV] = hcloud.Network(definitions.STAGE_DEV,
                         ip_range="10.10.1.0/24",
                         name=definitions.STAGE_DEV,
                         opts=pulumi.ResourceOptions(protect=True))

Log output

Diagnostics:
  hcloud:index:Network (core):
    error: error reading from server: EOF

  pulumi:pulumi:Stack (sys-main):
    panic: can't convert "x86" to cty.Value
    goroutine 99 [running]:
    github.com/hashicorp/terraform-plugin-sdk/v2/internal/configs/hcl2shim.HCL2ValueFromConfigValue({0x1018317c0?, 0x101af3bf0?})
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/[email protected]/internal/configs/hcl2shim/values.go:231 +0x31c
    github.com/hashicorp/terraform-plugin-sdk/v2/internal/configs/hcl2shim.HCL2ValueFromConfigValue({0x1018b5de0?, 0x1400018dad0?})
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/[email protected]/internal/configs/hcl2shim/values.go:225 +0x354
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.HCL2ValueFromConfigValue(...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/[email protected]/helper/schema/exports.go:15
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2.makeResourceRawConfigClassic(0x14000753288?, 0x1018b5de0?)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/[email protected]/pkg/tfshim/sdk-v2/cty.go:57 +0x34
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2.makeResourceRawConfig(0x140003b2460, 0x140000ee960?)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/[email protected]/pkg/tfshim/sdk-v2/cty.go:50 +0xf4
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2.v2Provider.ReadDataDiff({0x1400007f920?, {0x140001992a8?, 0x0?, 0xffffffffffffffff?}}, {0x101b07ba8, 0x140005a58f0}, {0x1014f636b, 0xc}, {0x101af8080?, 0x140003b2460})
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/[email protected]/pkg/tfshim/sdk-v2/provider.go:171 +0x9c
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.(*Provider).Invoke(0x14000145980, {0x101b07ba8?, 0x14000883170?}, 0x1400082a580)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/[email protected]/pkg/tfbridge/provider.go:1695 +0x894
    github.com/pulumi/pulumi-terraform-bridge/x/muxer.(*muxer).Invoke(0x1400038d920, {0x101b07ba8, 0x14000883170}, 0x1400082a580)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/x/[email protected]/muxer.go:342 +0x120
    github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Invoke_Handler.func1({0x101b07ba8, 0x14000883170}, {0x1019daca0?, 0x1400082a580})
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/[email protected]/proto/go/provider_grpc.pb.go:558 +0x74
    github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc.OpenTracingServerInterceptor.func1({0x101b07ba8, 0x14000882f00}, {0x1019daca0, 0x1400082a580}, 0x140001d43e0, 0x1400067a2d0)
        /home/runner/go/pkg/mod/github.com/grpc-ecosystem/[email protected]/go/otgrpc/server.go:57 +0x2e8
    github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Invoke_Handler({0x101ab3c80?, 0x1400038d920}, {0x101b07ba8, 0x14000882f00}, 0x1400082c980, 0x140003da140)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/[email protected]/proto/go/provider_grpc.pb.go:560 +0x12c
    google.golang.org/grpc.(*Server).processUnaryRPC(0x1400071e000, {0x101b07ba8, 0x14000882e40}, {0x101b12dc0, 0x1400025ea80}, 0x1400064aea0, 0x140008298f0, 0x102597118, 0x0)
        /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1369 +0xba0
    google.golang.org/grpc.(*Server).handleStream(0x1400071e000, {0x101b12dc0, 0x1400025ea80}, 0x1400064aea0)
        /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1780 +0xc80
    google.golang.org/grpc.(*Server).serveStreams.func2.1()
        /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1019 +0x8c
    created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 55
        /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1030 +0x150

Affected Resource(s)

I can only see it failing on network until now.

Output of pulumi about

> pulumi about
CLI          
Version      3.128.0
Go Version   go1.22.5
Go Compiler  gc

Plugins
KIND      NAME        VERSION
resource  cloudflare  5.35.0
resource  command     1.0.1
resource  github      6.2.3
resource  gitlab      8.2.0
resource  hcloud      1.20.0
language  python      unknown
resource  vault       6.2.0

Host     
OS       darwin
Version  14.6
Arch     arm64

This project is written in python: executable='/Users/me/_Privat/infra_sys/infra/sys/venv/bin/python' version='3.12.4'

Current Stack: eBeyond/sys/main

TYPE                                                  URN
pulumi:pulumi:Stack                                   urn:pulumi:main::sys::pulumi:pulumi:Stack::sys-main
pulumi:providers:cloudflare                           urn:pulumi:main::sys::pulumi:providers:cloudflare::default
pulumi:providers:cloudflare                           urn:pulumi:main::sys::pulumi:providers:cloudflare::default_5_24_1
cloudflare:index/record:Record                        urn:pulumi:main::sys::cloudflare:index/record:Record::fw-ext
<several more records
cloudflare:index/record:Record                        urn:pulumi:main::sys::cloudflare:index/record:Record::fw-int
pulumi:providers:hcloud                               urn:pulumi:main::sys::pulumi:providers:hcloud::default
cloudflare:index/record:Record                        urn:pulumi:main::sys::cloudflare:index/record:Record::star.domain-de
pulumi:providers:hcloud                               urn:pulumi:main::sys::pulumi:providers:hcloud::default_1_18_0
hcloud:index/network:Network                          urn:pulumi:main::sys::hcloud:index/network:Network::core
cloudflare:index/tunnelConfig:TunnelConfig            urn:pulumi:main::sys::cloudflare:index/tunnelConfig:TunnelConfig::tunnel-fw-ext
hcloud:index/network:Network                          urn:pulumi:main::sys::hcloud:index/network:Network::dev
hcloud:index/network:Network                          urn:pulumi:main::sys::hcloud:index/network:Network::prod
hcloud:index/server:Server                            urn:pulumi:main::sys::hcloud:index/server:Server::fw
pulumi:providers:vault                                urn:pulumi:main::sys::pulumi:providers:vault::default_6_1_0
vault:jwt/authBackend:AuthBackend                     urn:pulumi:main::sys::vault:jwt/authBackend:AuthBackend::gitlab
vault:index/authBackend:AuthBackend                   urn:pulumi:main::sys::vault:index/authBackend:AuthBackend::k8s_prod
vault:index/policy:Policy                             urn:pulumi:main::sys::vault:index/policy:Policy::vault-policy-cluster-core
hcloud:index/server:Server                            urn:pulumi:main::sys::hcloud:index/server:Server::mail-gw
hcloud:index/server:Server                            urn:pulumi:main::sys::hcloud:index/server:Server::srv01
vault:index/authBackend:AuthBackend                   urn:pulumi:main::sys::vault:index/authBackend:AuthBackend::approle
vault:index/policy:Policy                             urn:pulumi:main::sys::vault:index/policy:Policy::cert-manager
hcloud:index/serverNetwork:ServerNetwork              urn:pulumi:main::sys::hcloud:index/serverNetwork:ServerNetwork::fw_dev
hcloud:index/serverNetwork:ServerNetwork              urn:pulumi:main::sys::hcloud:index/serverNetwork:ServerNetwork::fw_prod
hcloud:index/serverNetwork:ServerNetwork              urn:pulumi:main::sys::hcloud:index/serverNetwork:ServerNetwork::fw_core
vault:kubernetes/authBackendConfig:AuthBackendConfig  urn:pulumi:main::sys::vault:kubernetes/authBackendConfig:AuthBackendConfig::k8s_prod
hcloud:index/serverNetwork:ServerNetwork              urn:pulumi:main::sys::hcloud:index/serverNetwork:ServerNetwork::mail-gw_core
vault:appRole/authBackendRole:AuthBackendRole         urn:pulumi:main::sys::vault:appRole/authBackendRole:AuthBackendRole::vault-backend-auth-role-core-mail_gw
vault:appRole/authBackendRole:AuthBackendRole         urn:pulumi:main::sys::vault:appRole/authBackendRole:AuthBackendRole::vault-backend-auth-role-core-srv01
hcloud:index/serverNetwork:ServerNetwork              urn:pulumi:main::sys::hcloud:index/serverNetwork:ServerNetwork::srv01_core
vault:kubernetes/authBackendRole:AuthBackendRole      urn:pulumi:main::sys::vault:kubernetes/authBackendRole:AuthBackendRole::cert-manager


Found no pending operations associated with main

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/eBeyond
User           eBeyond
Organizations  eBeyond
Token type     personal

Dependencies:
NAME               VERSION
pip                24.2
pulumi_cloudflare  5.35.0
pulumi_command     1.0.1
pulumi_github      6.2.3
pulumi_gitlab      8.2.0
pulumi_hcloud      1.20.0
pulumi_vault       6.2.0
pydantic           2.8.2
python-gitlab      4.8.0
setuptools         72.1.0
wheel              0.43.0

Pulumi locates its logs in /var/folders/2c/lc6pbx5s5ys5nxsdj9qbkrrr0000gn/T/ by default

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).

@eBeyond eBeyond added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Aug 7, 2024
@iwahbe iwahbe added p1 A bug severe enough to be the next item assigned to an engineer impact/panic This bug represents a panic or unexpected crash and removed needs-triage Needs attention from the triage team labels Aug 7, 2024
@iwahbe
Copy link
Member

iwahbe commented Aug 7, 2024

Hi @eBeyond. Thanks for opening an issue. I'm sorry that you are seeing a panic here. We will take a look as soon as possible.

@VenelinMartinov
Copy link
Contributor

Hey @eBeyond, thanks for reporting. I'm failing to reproduce the issue. The resource provisions fine for me.

Looking at the stack trace, it seems to suggest this is a problem with an Invoke, rather than the resource - are you using any functions somewhere in the program? Could you please post a program which exhibits the panic?

@VenelinMartinov VenelinMartinov added needs-repro Needs repro steps before it can be triaged or fixed awaiting-feedback Blocked on input from the author labels Aug 7, 2024
@eBeyond
Copy link
Author

eBeyond commented Aug 8, 2024

I've found the issue. It wasn't related to this module. Someone created a pyproject.toml and a poetry.lock. That seems to be the reason. After changing the pulumi.yaml to utilize poetry it starts working. Sorry

@eBeyond eBeyond closed this as completed Aug 8, 2024
@VenelinMartinov
Copy link
Contributor

Glad you found a solution @eBeyond. The panic you got is not the desired experience we'd like users to see, so if you have any more details about how you got pulumi to panic that'd be helpful in making sure other users don't hit the same issue.

Thanks!

@VenelinMartinov VenelinMartinov added resolution/no-repro This issue wasn't able to be reproduced and removed needs-repro Needs repro steps before it can be triaged or fixed awaiting-feedback Blocked on input from the author labels Aug 8, 2024
@eBeyond
Copy link
Author

eBeyond commented Aug 8, 2024

The last comment was wrong. It causes to reuse pretty old pulumi-hcloud. It was 1.17.1. If I immediatly updated to 1.20.0 I got the error again. After that I've tried to update release by release until 1.19.1. That was the last one working properly. If I do a pulumi refresh and pulumi up at this point I could update to 1.20.0. I think that it might be an issue with the state which could be outdated or not compatible with 1.20.0. But I'm not sure. After doing the refresh and up it was working as expected.

@eBeyond
Copy link
Author

eBeyond commented Aug 8, 2024

When running 1.20.0 it sometimes work, sometimes not. I'm trying to setup a script to reproduce it.

@VenelinMartinov
Copy link
Contributor

Okay, thanks. LMK if you find anything for us to dig into.

@eBeyond
Copy link
Author

eBeyond commented Sep 26, 2024

I've found the real issue with this issue now:
The issue wasn't related to pyproject.toml or the Network in hcloud. The issue which has lead to the panic was in the
get_image() function. If you've got two or more snapshots with a label "type=fw" and you try to get the latest with this call:

fw_img = hcloud.get_image(
        with_selector="type=fw",
        most_recent=True,
 )

it fail with the message: panics: can't convert "x86" to cty.Value
If you're defining the architecture like this:

fw_img = hcloud.get_image(
        with_selector="type=fw",
        most_recent=True,
        with_architecture="x86"
)

It works as expected. I think this has to do with the lookup of the snapshots within the get_image() function.

@eBeyond eBeyond reopened this Sep 26, 2024
@VenelinMartinov
Copy link
Contributor

Thanks for getting back to us @eBeyond. Does the same thing happen if you specify the id of the image instead of the properties?

For maintainers: this might be related to pulumi/pulumi-terraform-bridge#2282

@eBeyond
Copy link
Author

eBeyond commented Sep 26, 2024

Does not work, error as described:

 fw_img = hcloud.get_image(
        id="<existing_id>",
)

Works as expected:

fw_img = hcloud.get_image(
        id="<existing_id>",
        with_architecture="x86"
)

@mikhailshilkov mikhailshilkov added needs-triage Needs attention from the triage team and removed resolution/no-repro This issue wasn't able to be reproduced p1 A bug severe enough to be the next item assigned to an engineer labels Sep 27, 2024
@guineveresaenger guineveresaenger removed the needs-triage Needs attention from the triage team label Sep 27, 2024
@guineveresaenger
Copy link
Contributor

Hi @eBeyond - thank you for your help in root causing this.

It's looking like you have a workaround for now by specifying the architecture explicitly. It's looking like this will be resolved by pulumi/pulumi-terraform-bridge#2282. We'll update here as soon as we have a fix.

@guineveresaenger guineveresaenger added the awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). label Sep 27, 2024
@guineveresaenger guineveresaenger added the awaiting/bridge The issue cannot be resolved without action in pulumi-terraform-bridge. label Sep 27, 2024
@VenelinMartinov VenelinMartinov removed their assignment Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting/bridge The issue cannot be resolved without action in pulumi-terraform-bridge. awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). impact/panic This bug represents a panic or unexpected crash kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

5 participants