We recommend using Azure Native.
Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi
azure.compute.getImage
Explore with Pulumi AI
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)
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v5/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
})
}
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 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.applyValue(getImageResult -> getImageResult.id()));
}
}
variables:
search:
fn::invoke:
Function: azure:compute:getImage
Arguments:
name: search-api
resourceGroupName: packerimages
outputs:
imageId: ${search.id}
Using getImage
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 getImage(args: GetImageArgs, opts?: InvokeOptions): Promise<GetImageResult>
function getImageOutput(args: GetImageOutputArgs, opts?: InvokeOptions): Output<GetImageResult>
def get_image(name: Optional[str] = None,
name_regex: Optional[str] = None,
resource_group_name: Optional[str] = None,
sort_descending: Optional[bool] = None,
opts: Optional[InvokeOptions] = None) -> GetImageResult
def get_image_output(name: Optional[pulumi.Input[str]] = None,
name_regex: Optional[pulumi.Input[str]] = None,
resource_group_name: Optional[pulumi.Input[str]] = None,
sort_descending: Optional[pulumi.Input[bool]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetImageResult]
func LookupImage(ctx *Context, args *LookupImageArgs, opts ...InvokeOption) (*LookupImageResult, error)
func LookupImageOutput(ctx *Context, args *LookupImageOutputArgs, opts ...InvokeOption) LookupImageResultOutput
> Note: This function is named LookupImage
in the Go SDK.
public static class GetImage
{
public static Task<GetImageResult> InvokeAsync(GetImageArgs args, InvokeOptions? opts = null)
public static Output<GetImageResult> Invoke(GetImageInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetImageResult> getImage(GetImageArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: azure:compute/getImage:getImage
arguments:
# arguments dictionary
The following arguments are supported:
- Resource
Group stringName - The Name of the Resource Group where this Image exists.
- Name string
- The name of the Image.
- Name
Regex string - Regex pattern of the image to match.
- Sort
Descending bool - 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.
- Resource
Group stringName - The Name of the Resource Group where this Image exists.
- Name string
- The name of the Image.
- Name
Regex string - Regex pattern of the image to match.
- Sort
Descending bool - 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.
- resource
Group StringName - The Name of the Resource Group where this Image exists.
- name String
- The name of the Image.
- name
Regex String - Regex pattern of the image to match.
- sort
Descending Boolean - 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.
- resource
Group stringName - The Name of the Resource Group where this Image exists.
- name string
- The name of the Image.
- name
Regex string - Regex pattern of the image to match.
- sort
Descending boolean - 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.
- resource_
group_ strname - The Name of the Resource Group where this Image exists.
- name str
- The name of the Image.
- name_
regex str - Regex pattern of the image to match.
- sort_
descending bool - 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.
- resource
Group StringName - The Name of the Resource Group where this Image exists.
- name String
- The name of the Image.
- name
Regex String - Regex pattern of the image to match.
- sort
Descending Boolean - 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.
getImage Result
The following output properties are available:
- Data
Disks List<GetImage Data Disk> - a collection of
data_disk
blocks as defined below. - Id string
- The provider-assigned unique ID for this managed resource.
- Location string
- the Azure Location where this Image exists.
- Os
Disks List<GetImage Os Disk> - a
os_disk
block as defined below. - Resource
Group stringName - Dictionary<string, string>
- a mapping of tags to assigned to the resource.
- Zone
Resilient bool - is zone resiliency enabled?
- Name string
- the name of the Image.
- Name
Regex string - Sort
Descending bool
- Data
Disks []GetImage Data Disk - a collection of
data_disk
blocks as defined below. - Id string
- The provider-assigned unique ID for this managed resource.
- Location string
- the Azure Location where this Image exists.
- Os
Disks []GetImage Os Disk - a
os_disk
block as defined below. - Resource
Group stringName - map[string]string
- a mapping of tags to assigned to the resource.
- Zone
Resilient bool - is zone resiliency enabled?
- Name string
- the name of the Image.
- Name
Regex string - Sort
Descending bool
- data
Disks List<GetImage Data Disk> - a collection of
data_disk
blocks as defined below. - id String
- The provider-assigned unique ID for this managed resource.
- location String
- the Azure Location where this Image exists.
- os
Disks List<GetImage Os Disk> - a
os_disk
block as defined below. - resource
Group StringName - Map<String,String>
- a mapping of tags to assigned to the resource.
- zone
Resilient Boolean - is zone resiliency enabled?
- name String
- the name of the Image.
- name
Regex String - sort
Descending Boolean
- data
Disks GetImage Data Disk[] - a collection of
data_disk
blocks as defined below. - id string
- The provider-assigned unique ID for this managed resource.
- location string
- the Azure Location where this Image exists.
- os
Disks GetImage Os Disk[] - a
os_disk
block as defined below. - resource
Group stringName - {[key: string]: string}
- a mapping of tags to assigned to the resource.
- zone
Resilient boolean - is zone resiliency enabled?
- name string
- the name of the Image.
- name
Regex string - sort
Descending boolean
- data_
disks Sequence[GetImage Data Disk] - a collection of
data_disk
blocks as defined below. - id str
- The provider-assigned unique ID for this managed resource.
- location str
- the Azure Location where this Image exists.
- os_
disks Sequence[GetImage Os Disk] - a
os_disk
block as defined below. - resource_
group_ strname - Mapping[str, str]
- a mapping of tags to assigned to the resource.
- zone_
resilient bool - is zone resiliency enabled?
- name str
- the name of the Image.
- name_
regex str - sort_
descending bool
- data
Disks List<Property Map> - a collection of
data_disk
blocks as defined below. - id String
- The provider-assigned unique ID for this managed resource.
- location String
- the Azure Location where this Image exists.
- os
Disks List<Property Map> - a
os_disk
block as defined below. - resource
Group StringName - Map<String>
- a mapping of tags to assigned to the resource.
- zone
Resilient Boolean - is zone resiliency enabled?
- name String
- the name of the Image.
- name
Regex String - sort
Descending Boolean
Supporting Types
GetImageDataDisk
- Blob
Uri string - the URI in Azure storage of the blob used to create the image.
- Caching string
- the caching mode for the Data Disk, such as
ReadWrite
,ReadOnly
, orNone
. - Lun int
- the logical unit number of the data disk.
- Managed
Disk stringId - the ID of the Managed Disk used as the Data Disk Image.
- Size
Gb int - the size of this Data Disk in GB.
- Blob
Uri string - the URI in Azure storage of the blob used to create the image.
- Caching string
- the caching mode for the Data Disk, such as
ReadWrite
,ReadOnly
, orNone
. - Lun int
- the logical unit number of the data disk.
- Managed
Disk stringId - the ID of the Managed Disk used as the Data Disk Image.
- Size
Gb int - the size of this Data Disk in GB.
- blob
Uri String - the URI in Azure storage of the blob used to create the image.
- caching String
- the caching mode for the Data Disk, such as
ReadWrite
,ReadOnly
, orNone
. - lun Integer
- the logical unit number of the data disk.
- managed
Disk StringId - the ID of the Managed Disk used as the Data Disk Image.
- size
Gb Integer - the size of this Data Disk in GB.
- blob
Uri string - the URI in Azure storage of the blob used to create the image.
- caching string
- the caching mode for the Data Disk, such as
ReadWrite
,ReadOnly
, orNone
. - lun number
- the logical unit number of the data disk.
- managed
Disk stringId - the ID of the Managed Disk used as the Data Disk Image.
- size
Gb number - the size of this Data Disk in GB.
- blob_
uri str - the URI in Azure storage of the blob used to create the image.
- caching str
- the caching mode for the Data Disk, such as
ReadWrite
,ReadOnly
, orNone
. - lun int
- the logical unit number of the data disk.
- managed_
disk_ strid - the ID of the Managed Disk used as the Data Disk Image.
- size_
gb int - the size of this Data Disk in GB.
- blob
Uri String - the URI in Azure storage of the blob used to create the image.
- caching String
- the caching mode for the Data Disk, such as
ReadWrite
,ReadOnly
, orNone
. - lun Number
- the logical unit number of the data disk.
- managed
Disk StringId - the ID of the Managed Disk used as the Data Disk Image.
- size
Gb Number - the size of this Data Disk in GB.
GetImageOsDisk
- Blob
Uri string - the URI in Azure storage of the blob used to create the image.
- Caching string
- the caching mode for the Data Disk, such as
ReadWrite
,ReadOnly
, orNone
. - Managed
Disk stringId - the ID of the Managed Disk used as the Data Disk Image.
- Os
State string - the State of the OS used in the Image, such as
Generalized
. - Os
Type string - the type of Operating System used on the OS Disk. such as
Linux
orWindows
. - Size
Gb int - the size of this Data Disk in GB.
- Blob
Uri string - the URI in Azure storage of the blob used to create the image.
- Caching string
- the caching mode for the Data Disk, such as
ReadWrite
,ReadOnly
, orNone
. - Managed
Disk stringId - the ID of the Managed Disk used as the Data Disk Image.
- Os
State string - the State of the OS used in the Image, such as
Generalized
. - Os
Type string - the type of Operating System used on the OS Disk. such as
Linux
orWindows
. - Size
Gb int - the size of this Data Disk in GB.
- blob
Uri String - the URI in Azure storage of the blob used to create the image.
- caching String
- the caching mode for the Data Disk, such as
ReadWrite
,ReadOnly
, orNone
. - managed
Disk StringId - the ID of the Managed Disk used as the Data Disk Image.
- os
State String - the State of the OS used in the Image, such as
Generalized
. - os
Type String - the type of Operating System used on the OS Disk. such as
Linux
orWindows
. - size
Gb Integer - the size of this Data Disk in GB.
- blob
Uri string - the URI in Azure storage of the blob used to create the image.
- caching string
- the caching mode for the Data Disk, such as
ReadWrite
,ReadOnly
, orNone
. - managed
Disk stringId - the ID of the Managed Disk used as the Data Disk Image.
- os
State string - the State of the OS used in the Image, such as
Generalized
. - os
Type string - the type of Operating System used on the OS Disk. such as
Linux
orWindows
. - size
Gb number - the size of this Data Disk in GB.
- blob_
uri str - the URI in Azure storage of the blob used to create the image.
- caching str
- the caching mode for the Data Disk, such as
ReadWrite
,ReadOnly
, orNone
. - managed_
disk_ strid - the ID of the Managed Disk used as the Data Disk Image.
- os_
state str - the State of the OS used in the Image, such as
Generalized
. - os_
type str - the type of Operating System used on the OS Disk. such as
Linux
orWindows
. - size_
gb int - the size of this Data Disk in GB.
- blob
Uri String - the URI in Azure storage of the blob used to create the image.
- caching String
- the caching mode for the Data Disk, such as
ReadWrite
,ReadOnly
, orNone
. - managed
Disk StringId - the ID of the Managed Disk used as the Data Disk Image.
- os
State String - the State of the OS used in the Image, such as
Generalized
. - os
Type String - the type of Operating System used on the OS Disk. such as
Linux
orWindows
. - size
Gb Number - the size of this Data Disk in GB.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurerm
Terraform Provider.