getImage

suspend fun getImage(argument: GetImagePlainArgs): GetImageResult

Use this data source to access information about an existing Image.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const search = azure.compute.getImage({
name: "search-api",
resourceGroupName: "packerimages",
});
export const imageId = search.then(search => search.id);
import pulumi
import pulumi_azure as azure
search = azure.compute.get_image(name="search-api",
resource_group_name="packerimages")
pulumi.export("imageId", search.id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var search = Azure.Compute.GetImage.Invoke(new()
{
Name = "search-api",
ResourceGroupName = "packerimages",
});
return new Dictionary<string, object?>
{
["imageId"] = search.Apply(getImageResult => getImageResult.Id),
};
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
search, err := compute.LookupImage(ctx, &compute.LookupImageArgs{
Name: pulumi.StringRef("search-api"),
ResourceGroupName: "packerimages",
}, nil)
if err != nil {
return err
}
ctx.Export("imageId", search.Id)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.compute.ComputeFunctions;
import com.pulumi.azure.compute.inputs.GetImageArgs;
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 search = ComputeFunctions.getImage(GetImageArgs.builder()
.name("search-api")
.resourceGroupName("packerimages")
.build());
ctx.export("imageId", search.id());
}
}
variables:
search:
fn::invoke:
function: azure:compute:getImage
arguments:
name: search-api
resourceGroupName: packerimages
outputs:
imageId: ${search.id}

API Providers

This data source uses the following Azure API Providers:

  • Microsoft.Compute: 2022-03-01

Return

A collection of values returned by getImage.

Parameters

argument

A collection of arguments for invoking getImage.


suspend fun getImage(name: String? = null, nameRegex: String? = null, resourceGroupName: String, sortDescending: Boolean? = null): GetImageResult

Return

A collection of values returned by getImage.

Parameters

name

The name of the Image.

nameRegex

Regex pattern of the image to match.

resourceGroupName

The Name of the Resource Group where this Image exists.

sortDescending

By default when matching by regex, images are sorted by name in ascending order and the first match is chosen, to sort descending, set this flag.

See also


suspend fun getImage(argument: suspend GetImagePlainArgsBuilder.() -> Unit): GetImageResult

Return

A collection of values returned by getImage.

Parameters

argument

Builder for com.pulumi.azure.compute.kotlin.inputs.GetImagePlainArgs.

See also