pulumi / pulumi-google-native

Apache License 2.0
70 stars 18 forks source link

selfLink property "selfLink" not found #471

Open hcharley opened 2 years ago

hcharley commented 2 years ago

What happened?

Running pulumi preview failed using this resource type:

google-native:sqladmin/v1beta4:Database

With this error:

  Diagnostics:
    google-native:sqladmin/v1beta4:Database (my-database):
      error: Preview failed: selfLink property "selfLink" not found

    pulumi:pulumi:Stack (proj-stack):
      error: preview failed

   stderr: 
   err?: 

Steps to reproduce

    let previousDatabase: Database;

    for (const service of this.myStack.myEnvironment.getProperty(
      'myEnvironmentServicesCollection'
    ).requiresDatabaseAccess) {
      if (!service.canImportDatabasePulumiResource) {
        this.logger.warn(
          oneLineCommaListsAnd`Service ${service.slug} database cannot be imported because: ${service.cannotImportDatabasePulumiResourceReasons}`
        );
      }
      this.addResource(
        getDatabaseSlug(service.slug),
        new Database(
          `${service.slug}-database`,
          {
            name: service.databaseName,
            project: this.myStack.myEnvironment.getProperty(
              'gcpProjectIdOrDefault'
            ),
            instance:
              this.myStack.myEnvironment.getProperty(
                'gcpDatabaseInstance'
              ) ?? myConfig.cloudSqlInstance,
            charset: 'UTF8',
          },
          {
            dependsOn: [previousDatabase],
            parent: this,
            id: service.databasePulumiResourceId,
            retainOnDelete: true,
          }
        )
      );
      previousDatabase = this.getResource(getDatabaseSlug(service.slug));
    }

Expected Behavior

Expected to be able to preview the stack.

Actual Behavior

Failed to preview the stack.

Versions used

Pulumi version: 3.31.0-alpha.1650929512

Packages:

  '@pulumi/gcp': ^6.21.0
  '@pulumi/google-native': ^0.18.2
  '@pulumi/kubernetes': ^3.18.3
  '@pulumi/postgresql': ^3.4.0
  '@pulumi/pulumi': ^3.31.0-alpha.1650929512
  '@pulumi/random': ^4.5.0

Additional context

Using Pulumi automation API via NodeJS.

Related(?) ticket and first mention of this issue found in this comment:

https://github.com/pulumi/pulumi-google-native/issues/35#issuecomment-1114910494

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

vschettino-asimov commented 2 years ago

Just to add some info: looks like this a common issue with several google-native components. I see the same erros with NetworkEndpointGroup and SslCertificate as well, to name a few. If I manually edit the stack to add outputs.selfLink (should be the same as the id), I get a different error message:

Diagnostics:
  google-native:compute/v1:RegionNetworkEndpointGroup (xxx-xxx-xxx):
    error: Preview failed: Import is not yet implemented
hcharley commented 2 years ago

Ah, just to make the jump @vschettino-asimov, it seems it is possible/probable that the selfLink error is just obscuring the Import is not yet implemented error.

Edit: here is the ticket for importing: https://github.com/pulumi/pulumi-google-native/issues/81

sgarciajaramillo commented 2 years ago

This was working fine for me for a while. It now breaks both during pulumi up or pulumi destroy

google-native:compute/v1:Disk (gce_disk): error: Preview failed: selfLink property "selfLink" not found

I've upgraded the package for google-native and pulumi and no dice.

├─ @pulumi/google-native@0.20.0 │ └─ @pulumi/pulumi@^3.0.0 ├─ @pulumi/pulumi@3.34.1 │ ├─ @grpc/grpc-js@~1.3.8 │ ├─ @logdna/tail-file@^2.0.6 │ ├─ @pulumi/query@^0.3.0 │ ├─ google-protobuf@^3.5.0 │ ├─ ini@^2.0.0 │ ├─ js-yaml@^3.14.0 │ ├─ minimist@^1.2.6 │ ├─ normalize-package-data@^2.4.0 │ ├─ read-package-tree@^5.3.1 │ ├─ require-from-string@^2.0.1 │ ├─ semver@^6.1.0 │ ├─ source-map-support@^0.4.16 │ ├─ ts-node@^7.0.1 │ ├─ typescript@~3.7.3 │ └─ upath@^1.1.0

solomonshorser commented 2 years ago

I get the same message when I try to import an existing resource (a google-native:storage/v1:Bucket) using pulumi import.

viveklak commented 2 years ago

@solomonshorser Yes import support is not yet in place. We are actively prioritizing https://github.com/pulumi/pulumi-google-native/issues/81 to support this.

solomonshorser commented 2 years ago

@viveklak My future projects look forward to this!