Viewing docs for Google Cloud v9.15.0
published on Thursday, Mar 12, 2026 by Pulumi
published on Thursday, Mar 12, 2026 by Pulumi
Viewing docs for Google Cloud v9.15.0
published on Thursday, Mar 12, 2026 by Pulumi
published on Thursday, Mar 12, 2026 by Pulumi
This data source fetches information from a provided Artifact Registry repository, based on a the latest version of the package and optional version.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const npmRepo = new gcp.artifactregistry.Repository("npm_repo", {
location: "us-central1",
repositoryId: "my-npm-repo",
format: "NPM",
});
const latest = gcp.artifactregistry.getNpmPackageOutput({
location: npmRepo.location,
repositoryId: npmRepo.repositoryId,
packageName: "example-pkg",
});
const withVersion = gcp.artifactregistry.getNpmPackageOutput({
location: npmRepo.location,
repositoryId: npmRepo.repositoryId,
packageName: "example-pkg:1.0.0",
});
import pulumi
import pulumi_gcp as gcp
npm_repo = gcp.artifactregistry.Repository("npm_repo",
location="us-central1",
repository_id="my-npm-repo",
format="NPM")
latest = gcp.artifactregistry.get_npm_package_output(location=npm_repo.location,
repository_id=npm_repo.repository_id,
package_name="example-pkg")
with_version = gcp.artifactregistry.get_npm_package_output(location=npm_repo.location,
repository_id=npm_repo.repository_id,
package_name="example-pkg:1.0.0")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/artifactregistry"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
npmRepo, err := artifactregistry.NewRepository(ctx, "npm_repo", &artifactregistry.RepositoryArgs{
Location: pulumi.String("us-central1"),
RepositoryId: pulumi.String("my-npm-repo"),
Format: pulumi.String("NPM"),
})
if err != nil {
return err
}
_ = artifactregistry.GetNpmPackageOutput(ctx, artifactregistry.GetNpmPackageOutputArgs{
Location: npmRepo.Location,
RepositoryId: npmRepo.RepositoryId,
PackageName: pulumi.String("example-pkg"),
}, nil)
_ = artifactregistry.GetNpmPackageOutput(ctx, artifactregistry.GetNpmPackageOutputArgs{
Location: npmRepo.Location,
RepositoryId: npmRepo.RepositoryId,
PackageName: pulumi.String("example-pkg:1.0.0"),
}, nil)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var npmRepo = new Gcp.ArtifactRegistry.Repository("npm_repo", new()
{
Location = "us-central1",
RepositoryId = "my-npm-repo",
Format = "NPM",
});
var latest = Gcp.ArtifactRegistry.GetNpmPackage.Invoke(new()
{
Location = npmRepo.Location,
RepositoryId = npmRepo.RepositoryId,
PackageName = "example-pkg",
});
var withVersion = Gcp.ArtifactRegistry.GetNpmPackage.Invoke(new()
{
Location = npmRepo.Location,
RepositoryId = npmRepo.RepositoryId,
PackageName = "example-pkg:1.0.0",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.artifactregistry.Repository;
import com.pulumi.gcp.artifactregistry.RepositoryArgs;
import com.pulumi.gcp.artifactregistry.ArtifactregistryFunctions;
import com.pulumi.gcp.artifactregistry.inputs.GetNpmPackageArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var npmRepo = new Repository("npmRepo", RepositoryArgs.builder()
.location("us-central1")
.repositoryId("my-npm-repo")
.format("NPM")
.build());
final var latest = ArtifactregistryFunctions.getNpmPackage(GetNpmPackageArgs.builder()
.location(npmRepo.location())
.repositoryId(npmRepo.repositoryId())
.packageName("example-pkg")
.build());
final var withVersion = ArtifactregistryFunctions.getNpmPackage(GetNpmPackageArgs.builder()
.location(npmRepo.location())
.repositoryId(npmRepo.repositoryId())
.packageName("example-pkg:1.0.0")
.build());
}
}
resources:
npmRepo:
type: gcp:artifactregistry:Repository
name: npm_repo
properties:
location: us-central1
repositoryId: my-npm-repo
format: NPM
variables:
latest:
fn::invoke:
function: gcp:artifactregistry:getNpmPackage
arguments:
location: ${npmRepo.location}
repositoryId: ${npmRepo.repositoryId}
packageName: example-pkg
withVersion:
fn::invoke:
function: gcp:artifactregistry:getNpmPackage
arguments:
location: ${npmRepo.location}
repositoryId: ${npmRepo.repositoryId}
packageName: example-pkg:1.0.0
Using getNpmPackage
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getNpmPackage(args: GetNpmPackageArgs, opts?: InvokeOptions): Promise<GetNpmPackageResult>
function getNpmPackageOutput(args: GetNpmPackageOutputArgs, opts?: InvokeOptions): Output<GetNpmPackageResult>def get_npm_package(location: Optional[str] = None,
package_name: Optional[str] = None,
project: Optional[str] = None,
repository_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetNpmPackageResult
def get_npm_package_output(location: Optional[pulumi.Input[str]] = None,
package_name: Optional[pulumi.Input[str]] = None,
project: Optional[pulumi.Input[str]] = None,
repository_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetNpmPackageResult]func GetNpmPackage(ctx *Context, args *GetNpmPackageArgs, opts ...InvokeOption) (*GetNpmPackageResult, error)
func GetNpmPackageOutput(ctx *Context, args *GetNpmPackageOutputArgs, opts ...InvokeOption) GetNpmPackageResultOutput> Note: This function is named GetNpmPackage in the Go SDK.
public static class GetNpmPackage
{
public static Task<GetNpmPackageResult> InvokeAsync(GetNpmPackageArgs args, InvokeOptions? opts = null)
public static Output<GetNpmPackageResult> Invoke(GetNpmPackageInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetNpmPackageResult> getNpmPackage(GetNpmPackageArgs args, InvokeOptions options)
public static Output<GetNpmPackageResult> getNpmPackage(GetNpmPackageArgs args, InvokeOptions options)
fn::invoke:
function: gcp:artifactregistry/getNpmPackage:getNpmPackage
arguments:
# arguments dictionaryThe following arguments are supported:
- Location string
- The location of the Artifact Registry repository.
- Package
Name string - The name of the package to fetch. Can optionally include a specific version (e.g.,
my_pkg:1.2.3). If no version is provided, the latest version is used. - Repository
Id string - The ID of the repository containing the NPM package.
- Project string
- The ID of the project that owns the repository. If not provided, the provider-level project is used.
- Location string
- The location of the Artifact Registry repository.
- Package
Name string - The name of the package to fetch. Can optionally include a specific version (e.g.,
my_pkg:1.2.3). If no version is provided, the latest version is used. - Repository
Id string - The ID of the repository containing the NPM package.
- Project string
- The ID of the project that owns the repository. If not provided, the provider-level project is used.
- location String
- The location of the Artifact Registry repository.
- package
Name String - The name of the package to fetch. Can optionally include a specific version (e.g.,
my_pkg:1.2.3). If no version is provided, the latest version is used. - repository
Id String - The ID of the repository containing the NPM package.
- project String
- The ID of the project that owns the repository. If not provided, the provider-level project is used.
- location string
- The location of the Artifact Registry repository.
- package
Name string - The name of the package to fetch. Can optionally include a specific version (e.g.,
my_pkg:1.2.3). If no version is provided, the latest version is used. - repository
Id string - The ID of the repository containing the NPM package.
- project string
- The ID of the project that owns the repository. If not provided, the provider-level project is used.
- location str
- The location of the Artifact Registry repository.
- package_
name str - The name of the package to fetch. Can optionally include a specific version (e.g.,
my_pkg:1.2.3). If no version is provided, the latest version is used. - repository_
id str - The ID of the repository containing the NPM package.
- project str
- The ID of the project that owns the repository. If not provided, the provider-level project is used.
- location String
- The location of the Artifact Registry repository.
- package
Name String - The name of the package to fetch. Can optionally include a specific version (e.g.,
my_pkg:1.2.3). If no version is provided, the latest version is used. - repository
Id String - The ID of the repository containing the NPM package.
- project String
- The ID of the project that owns the repository. If not provided, the provider-level project is used.
getNpmPackage Result
The following output properties are available:
- Create
Time string - The time the package was created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Location string
- Name string
- The fully qualified name of the fetched package. Format:
projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}/npmPackages/{{package}}:{{version}} - Package
Name string - Repository
Id string - List<string>
- A list of all Tags attached to this package.
- Update
Time string - The time the package was last updated.
- Version string
- The version of the NPM package.
- Project string
- Create
Time string - The time the package was created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Location string
- Name string
- The fully qualified name of the fetched package. Format:
projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}/npmPackages/{{package}}:{{version}} - Package
Name string - Repository
Id string - []string
- A list of all Tags attached to this package.
- Update
Time string - The time the package was last updated.
- Version string
- The version of the NPM package.
- Project string
- create
Time String - The time the package was created.
- id String
- The provider-assigned unique ID for this managed resource.
- location String
- name String
- The fully qualified name of the fetched package. Format:
projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}/npmPackages/{{package}}:{{version}} - package
Name String - repository
Id String - List<String>
- A list of all Tags attached to this package.
- update
Time String - The time the package was last updated.
- version String
- The version of the NPM package.
- project String
- create
Time string - The time the package was created.
- id string
- The provider-assigned unique ID for this managed resource.
- location string
- name string
- The fully qualified name of the fetched package. Format:
projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}/npmPackages/{{package}}:{{version}} - package
Name string - repository
Id string - string[]
- A list of all Tags attached to this package.
- update
Time string - The time the package was last updated.
- version string
- The version of the NPM package.
- project string
- create_
time str - The time the package was created.
- id str
- The provider-assigned unique ID for this managed resource.
- location str
- name str
- The fully qualified name of the fetched package. Format:
projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}/npmPackages/{{package}}:{{version}} - package_
name str - repository_
id str - Sequence[str]
- A list of all Tags attached to this package.
- update_
time str - The time the package was last updated.
- version str
- The version of the NPM package.
- project str
- create
Time String - The time the package was created.
- id String
- The provider-assigned unique ID for this managed resource.
- location String
- name String
- The fully qualified name of the fetched package. Format:
projects/{{project}}/locations/{{location}}/repositories/{{repository_id}}/npmPackages/{{package}}:{{version}} - package
Name String - repository
Id String - List<String>
- A list of all Tags attached to this package.
- update
Time String - The time the package was last updated.
- version String
- The version of the NPM package.
- project String
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-betaTerraform Provider.
Viewing docs for Google Cloud v9.15.0
published on Thursday, Mar 12, 2026 by Pulumi
published on Thursday, Mar 12, 2026 by Pulumi
