1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. container
  5. getRegistryImage
Google Cloud v8.23.0 published on Monday, Mar 24, 2025 by Pulumi

gcp.container.getRegistryImage

Explore with Pulumi AI

Google Cloud v8.23.0 published on Monday, Mar 24, 2025 by Pulumi

This data source fetches the project name, and provides the appropriate URLs to use for container registry for this project.

The URLs are computed entirely offline - as long as the project exists, they will be valid, but this data source does not contact Google Container Registry (GCR) at any point.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const debian = gcp.container.getRegistryImage({
    name: "debian",
});
export const gcrLocation = debian.then(debian => debian.imageUrl);
Copy
import pulumi
import pulumi_gcp as gcp

debian = gcp.container.get_registry_image(name="debian")
pulumi.export("gcrLocation", debian.image_url)
Copy
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/container"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		debian, err := container.GetRegistryImage(ctx, &container.GetRegistryImageArgs{
			Name: "debian",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("gcrLocation", debian.ImageUrl)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var debian = Gcp.Container.GetRegistryImage.Invoke(new()
    {
        Name = "debian",
    });

    return new Dictionary<string, object?>
    {
        ["gcrLocation"] = debian.Apply(getRegistryImageResult => getRegistryImageResult.ImageUrl),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.container.ContainerFunctions;
import com.pulumi.gcp.container.inputs.GetRegistryImageArgs;
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) {
        final var debian = ContainerFunctions.getRegistryImage(GetRegistryImageArgs.builder()
            .name("debian")
            .build());

        ctx.export("gcrLocation", debian.applyValue(getRegistryImageResult -> getRegistryImageResult.imageUrl()));
    }
}
Copy
variables:
  debian:
    fn::invoke:
      function: gcp:container:getRegistryImage
      arguments:
        name: debian
outputs:
  gcrLocation: ${debian.imageUrl}
Copy

Using getRegistryImage

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 getRegistryImage(args: GetRegistryImageArgs, opts?: InvokeOptions): Promise<GetRegistryImageResult>
function getRegistryImageOutput(args: GetRegistryImageOutputArgs, opts?: InvokeOptions): Output<GetRegistryImageResult>
Copy
def get_registry_image(digest: Optional[str] = None,
                       name: Optional[str] = None,
                       project: Optional[str] = None,
                       region: Optional[str] = None,
                       tag: Optional[str] = None,
                       opts: Optional[InvokeOptions] = None) -> GetRegistryImageResult
def get_registry_image_output(digest: Optional[pulumi.Input[str]] = None,
                       name: Optional[pulumi.Input[str]] = None,
                       project: Optional[pulumi.Input[str]] = None,
                       region: Optional[pulumi.Input[str]] = None,
                       tag: Optional[pulumi.Input[str]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetRegistryImageResult]
Copy
func GetRegistryImage(ctx *Context, args *GetRegistryImageArgs, opts ...InvokeOption) (*GetRegistryImageResult, error)
func GetRegistryImageOutput(ctx *Context, args *GetRegistryImageOutputArgs, opts ...InvokeOption) GetRegistryImageResultOutput
Copy

> Note: This function is named GetRegistryImage in the Go SDK.

public static class GetRegistryImage 
{
    public static Task<GetRegistryImageResult> InvokeAsync(GetRegistryImageArgs args, InvokeOptions? opts = null)
    public static Output<GetRegistryImageResult> Invoke(GetRegistryImageInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetRegistryImageResult> getRegistryImage(GetRegistryImageArgs args, InvokeOptions options)
public static Output<GetRegistryImageResult> getRegistryImage(GetRegistryImageArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: gcp:container/getRegistryImage:getRegistryImage
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
The image name.
Digest string
The image digest to fetch, if any.
Project string
The project ID that this image is attached to. If not provider, provider project will be used instead.
Region string
The GCR region to use. As of this writing, one of asia, eu, and us. See the documentation for additional information.
Tag string
The tag to fetch, if any.
Name This property is required. string
The image name.
Digest string
The image digest to fetch, if any.
Project string
The project ID that this image is attached to. If not provider, provider project will be used instead.
Region string
The GCR region to use. As of this writing, one of asia, eu, and us. See the documentation for additional information.
Tag string
The tag to fetch, if any.
name This property is required. String
The image name.
digest String
The image digest to fetch, if any.
project String
The project ID that this image is attached to. If not provider, provider project will be used instead.
region String
The GCR region to use. As of this writing, one of asia, eu, and us. See the documentation for additional information.
tag String
The tag to fetch, if any.
name This property is required. string
The image name.
digest string
The image digest to fetch, if any.
project string
The project ID that this image is attached to. If not provider, provider project will be used instead.
region string
The GCR region to use. As of this writing, one of asia, eu, and us. See the documentation for additional information.
tag string
The tag to fetch, if any.
name This property is required. str
The image name.
digest str
The image digest to fetch, if any.
project str
The project ID that this image is attached to. If not provider, provider project will be used instead.
region str
The GCR region to use. As of this writing, one of asia, eu, and us. See the documentation for additional information.
tag str
The tag to fetch, if any.
name This property is required. String
The image name.
digest String
The image digest to fetch, if any.
project String
The project ID that this image is attached to. If not provider, provider project will be used instead.
region String
The GCR region to use. As of this writing, one of asia, eu, and us. See the documentation for additional information.
tag String
The tag to fetch, if any.

getRegistryImage Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
ImageUrl string
The URL at which the image can be accessed.
Name string
Project string
Digest string
Region string
Tag string
Id string
The provider-assigned unique ID for this managed resource.
ImageUrl string
The URL at which the image can be accessed.
Name string
Project string
Digest string
Region string
Tag string
id String
The provider-assigned unique ID for this managed resource.
imageUrl String
The URL at which the image can be accessed.
name String
project String
digest String
region String
tag String
id string
The provider-assigned unique ID for this managed resource.
imageUrl string
The URL at which the image can be accessed.
name string
project string
digest string
region string
tag string
id str
The provider-assigned unique ID for this managed resource.
image_url str
The URL at which the image can be accessed.
name str
project str
digest str
region str
tag str
id String
The provider-assigned unique ID for this managed resource.
imageUrl String
The URL at which the image can be accessed.
name String
project String
digest String
region String
tag String

Package Details

Repository
Google Cloud (GCP) Classic pulumi/pulumi-gcp
License
Apache-2.0
Notes
This Pulumi package is based on the google-beta Terraform Provider.
Google Cloud v8.23.0 published on Monday, Mar 24, 2025 by Pulumi