Hi all, I am experiencing an error when importing ...
# general
m
Hi all, I am experiencing an error when importing a resource into pulumi. When I run
pulumi import -f import-resources.json
with the following file (abbreviated for clarity - the other resources import fine) I get an error.
Copy code
{
  "resources": [
    {
      "type": "gcp:compute/vPNTunnel:VPNTunnel",
      "name": "vpn-tunnel",
      "id": "projects/<prj>/regions/<region>/vpnTunnels/vpn-tunnel"
    }
  ]
}
Here's the error:
Copy code
Diagnostics:
  pulumi:pulumi:Stack (network-testing):
    error: update failed
 
  gcp:compute:VPNTunnel (vpn-tunnel):
    error: gcp:compute/vPNTunnel:VPNTunnel resource 'vpn-tunnel' has a problem: Required attribute is not set. Examine values at 'VPNTunnel.SharedSecret'.
    error: one or more inputs failed to validate
Since I did not see a documented way to set this attribute I tried creating the object in my pulumi programming with the
_import_
annotation like so:
Copy code
vpn_tunnel = gcp.compute.VPNTunnel(
    "vpn-tunnel",
    name="vpn-tunnel",
    shared_secret="redacted",
    target_vpn_gateway="redacted",
    opts=pulumi.ResourceOptions(
        import_="projects/<prj>/regions/<region>/vpnTunnels/vpn-tunnel",
    ),
)
However, that resulted in an error as well (when running
pulumi preview
):
Copy code
warning: inputs to import do not match the existing resource; importing this resource will fail
    = gcp:compute/vPNTunnel:VPNTunnel: (import)
        [id=projects/<prj>/regions/<region>/vpnTunnels/vpn-tunnel]
        [urn=urn:pulumi:testing::network::gcp:compute/vPNTunnel:VPNTunnel::vpn-tunnel]
        [provider=urn:pulumi:testing::network::pulumi:providers:gcp::default_4_21_0::9400fa64-3729-3efb-bb74-7183febcae7b]
      + sharedSecret: "redacted"
How can I import that resource cleanly?