Google Cloud (GCP) Classic

v6.38.0 published on Thursday, Sep 22, 2022 by Pulumi

getRegistryImage

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

using System.Collections.Generic;
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),
    };
});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/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
	})
}
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()));
    }
}
import pulumi
import pulumi_gcp as gcp

debian = gcp.container.get_registry_image(name="debian")
pulumi.export("gcrLocation", debian.image_url)
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);
variables:
  debian:
    Fn::Invoke:
      Function: gcp:container:getRegistryImage
      Arguments:
        name: debian
outputs:
  gcrLocation: ${debian.imageUrl}

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>
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]
func GetRegistryImage(ctx *Context, args *GetRegistryImageArgs, opts ...InvokeOption) (*GetRegistryImageResult, error)
func GetRegistryImageOutput(ctx *Context, args *GetRegistryImageOutputArgs, opts ...InvokeOption) GetRegistryImageResultOutput

> 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)
}
public static CompletableFuture<GetRegistryImageResult> getRegistryImage(GetRegistryImageArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: gcp:container/getRegistryImage:getRegistryImage
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Name string
Digest string
Project string
Region string
Tag string
Name string
Digest string
Project string
Region string
Tag string
name String
digest String
project String
region String
tag String
name string
digest string
project string
region string
tag string
name str
digest str
project str
region str
tag str
name String
digest String
project String
region String
tag String

getRegistryImage Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

ImageUrl string
Name string
Project string
Digest string
Region string
Tag string
Id string

The provider-assigned unique ID for this managed resource.

ImageUrl string
Name string
Project string
Digest string
Region string
Tag string
id String

The provider-assigned unique ID for this managed resource.

imageUrl String
name String
project String
digest String
region String
tag String
id string

The provider-assigned unique ID for this managed resource.

imageUrl string
name string
project string
digest string
region string
tag string
id str

The provider-assigned unique ID for this managed resource.

image_url str
name str
project str
digest str
region str
tag str
id String

The provider-assigned unique ID for this managed resource.

imageUrl String
name String
project String
digest String
region String
tag String

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes

This Pulumi package is based on the google-beta Terraform Provider.