1. Packages
  2. Vra Provider
  3. API Docs
  4. getImage
vra 0.12.0 published on Monday, Apr 14, 2025 by vmware

vra.getImage

Explore with Pulumi AI

vra logo
vra 0.12.0 published on Monday, Apr 14, 2025 by vmware

    The vra.getImage data source can be used to discover the lookup machine images with cloud accounts. This can then be used with resource that require an image. For example, to create an image profile using the vra.ImageProfile resource.

    Example Usage

    This is an example of how to lookup images.

    Image data source by Id:

    import * as pulumi from "@pulumi/pulumi";
    import * as vra from "@pulumi/vra";
    
    const _this = vra.getImage({
        id: _var.image_id,
    });
    
    import pulumi
    import pulumi_vra as vra
    
    this = vra.get_image(id=var["image_id"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/vra/vra"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := vra.GetImage(ctx, &vra.GetImageArgs{
    			Id: pulumi.StringRef(_var.Image_id),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vra = Pulumi.Vra;
    
    return await Deployment.RunAsync(() => 
    {
        var @this = Vra.GetImage.Invoke(new()
        {
            Id = @var.Image_id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vra.VraFunctions;
    import com.pulumi.vra.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 this = VraFunctions.getImage(GetImageArgs.builder()
                .id(var_.image_id())
                .build());
    
        }
    }
    
    variables:
      this:
        fn::invoke:
          function: vra:getImage
          arguments:
            id: ${var.image_id}
    

    Image data source by filter query:

    import * as pulumi from "@pulumi/pulumi";
    import * as vra from "@pulumi/vra";
    
    const _this = vra.getImage({
        filter: `name eq '${_var.image_name}'`,
    });
    
    import pulumi
    import pulumi_vra as vra
    
    this = vra.get_image(filter=f"name eq '{var['image_name']}'")
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/vra/vra"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := vra.GetImage(ctx, &vra.GetImageArgs{
    			Filter: pulumi.StringRef(fmt.Sprintf("name eq '%v'", _var.Image_name)),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vra = Pulumi.Vra;
    
    return await Deployment.RunAsync(() => 
    {
        var @this = Vra.GetImage.Invoke(new()
        {
            Filter = $"name eq '{@var.Image_name}'",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vra.VraFunctions;
    import com.pulumi.vra.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 this = VraFunctions.getImage(GetImageArgs.builder()
                .filter(String.format("name eq '%s'", var_.image_name()))
                .build());
    
        }
    }
    
    variables:
      this:
        fn::invoke:
          function: vra:getImage
          arguments:
            filter: name eq '${var.image_name}'
    

    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(filter: Optional[str] = None,
                  id: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetImageResult
    def get_image_output(filter: Optional[pulumi.Input[str]] = None,
                  id: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetImageResult]
    func GetImage(ctx *Context, args *GetImageArgs, opts ...InvokeOption) (*GetImageResult, error)
    func GetImageOutput(ctx *Context, args *GetImageOutputArgs, opts ...InvokeOption) GetImageResultOutput

    > Note: This function is named GetImage 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)
    public static Output<GetImageResult> getImage(GetImageArgs args, InvokeOptions options)
    
    fn::invoke:
      function: vra:index/getImage:getImage
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Filter string
    Search criteria to narrow down the image resource instance. Only one of 'id' or 'filter' must be specified.
    Id string
    The id of the image resource instance. Only one of 'id' or 'filter' must be specified.
    Filter string
    Search criteria to narrow down the image resource instance. Only one of 'id' or 'filter' must be specified.
    Id string
    The id of the image resource instance. Only one of 'id' or 'filter' must be specified.
    filter String
    Search criteria to narrow down the image resource instance. Only one of 'id' or 'filter' must be specified.
    id String
    The id of the image resource instance. Only one of 'id' or 'filter' must be specified.
    filter string
    Search criteria to narrow down the image resource instance. Only one of 'id' or 'filter' must be specified.
    id string
    The id of the image resource instance. Only one of 'id' or 'filter' must be specified.
    filter str
    Search criteria to narrow down the image resource instance. Only one of 'id' or 'filter' must be specified.
    id str
    The id of the image resource instance. Only one of 'id' or 'filter' must be specified.
    filter String
    Search criteria to narrow down the image resource instance. Only one of 'id' or 'filter' must be specified.
    id String
    The id of the image resource instance. Only one of 'id' or 'filter' must be specified.

    getImage Result

    The following output properties are available:

    CreatedAt string
    Date when the entity was created. The date is in ISO 8601 and UTC
    CustomProperties Dictionary<string, string>
    A list of key value pair of custom properties for the image resource.
    Description string
    A human-friendly description.
    ExternalId string
    External entity Id on the provider side.
    Id string
    Links List<GetImageLink>
    HATEOAS of the entity.
    Name string
    A human-friendly name used as an identifier for the image resource instance.
    OrgId string
    The id of the organization this entity belongs to.
    OsFamily string
    Operating System family of the image.
    Owner string
    Email of the user that owns the entity.
    Private bool
    Indicates whether this image is private. For vSphere, private images are considered to be templates and snapshots and public are Content Library Items.
    Region string
    The region of the image. For a vSphere cloud account, it is the externalRegionId such as Datacenter:datacenter-2 and for an AWS cloud account, it is region name such as us-east-1, etc.
    UpdatedAt string
    Date when the entity was last updated. The date is ISO 8601 and UTC.
    Filter string
    CreatedAt string
    Date when the entity was created. The date is in ISO 8601 and UTC
    CustomProperties map[string]string
    A list of key value pair of custom properties for the image resource.
    Description string
    A human-friendly description.
    ExternalId string
    External entity Id on the provider side.
    Id string
    Links []GetImageLink
    HATEOAS of the entity.
    Name string
    A human-friendly name used as an identifier for the image resource instance.
    OrgId string
    The id of the organization this entity belongs to.
    OsFamily string
    Operating System family of the image.
    Owner string
    Email of the user that owns the entity.
    Private bool
    Indicates whether this image is private. For vSphere, private images are considered to be templates and snapshots and public are Content Library Items.
    Region string
    The region of the image. For a vSphere cloud account, it is the externalRegionId such as Datacenter:datacenter-2 and for an AWS cloud account, it is region name such as us-east-1, etc.
    UpdatedAt string
    Date when the entity was last updated. The date is ISO 8601 and UTC.
    Filter string
    createdAt String
    Date when the entity was created. The date is in ISO 8601 and UTC
    customProperties Map<String,String>
    A list of key value pair of custom properties for the image resource.
    description String
    A human-friendly description.
    externalId String
    External entity Id on the provider side.
    id String
    links List<GetImageLink>
    HATEOAS of the entity.
    name String
    A human-friendly name used as an identifier for the image resource instance.
    orgId String
    The id of the organization this entity belongs to.
    osFamily String
    Operating System family of the image.
    owner String
    Email of the user that owns the entity.
    private_ Boolean
    Indicates whether this image is private. For vSphere, private images are considered to be templates and snapshots and public are Content Library Items.
    region String
    The region of the image. For a vSphere cloud account, it is the externalRegionId such as Datacenter:datacenter-2 and for an AWS cloud account, it is region name such as us-east-1, etc.
    updatedAt String
    Date when the entity was last updated. The date is ISO 8601 and UTC.
    filter String
    createdAt string
    Date when the entity was created. The date is in ISO 8601 and UTC
    customProperties {[key: string]: string}
    A list of key value pair of custom properties for the image resource.
    description string
    A human-friendly description.
    externalId string
    External entity Id on the provider side.
    id string
    links GetImageLink[]
    HATEOAS of the entity.
    name string
    A human-friendly name used as an identifier for the image resource instance.
    orgId string
    The id of the organization this entity belongs to.
    osFamily string
    Operating System family of the image.
    owner string
    Email of the user that owns the entity.
    private boolean
    Indicates whether this image is private. For vSphere, private images are considered to be templates and snapshots and public are Content Library Items.
    region string
    The region of the image. For a vSphere cloud account, it is the externalRegionId such as Datacenter:datacenter-2 and for an AWS cloud account, it is region name such as us-east-1, etc.
    updatedAt string
    Date when the entity was last updated. The date is ISO 8601 and UTC.
    filter string
    created_at str
    Date when the entity was created. The date is in ISO 8601 and UTC
    custom_properties Mapping[str, str]
    A list of key value pair of custom properties for the image resource.
    description str
    A human-friendly description.
    external_id str
    External entity Id on the provider side.
    id str
    links Sequence[GetImageLink]
    HATEOAS of the entity.
    name str
    A human-friendly name used as an identifier for the image resource instance.
    org_id str
    The id of the organization this entity belongs to.
    os_family str
    Operating System family of the image.
    owner str
    Email of the user that owns the entity.
    private bool
    Indicates whether this image is private. For vSphere, private images are considered to be templates and snapshots and public are Content Library Items.
    region str
    The region of the image. For a vSphere cloud account, it is the externalRegionId such as Datacenter:datacenter-2 and for an AWS cloud account, it is region name such as us-east-1, etc.
    updated_at str
    Date when the entity was last updated. The date is ISO 8601 and UTC.
    filter str
    createdAt String
    Date when the entity was created. The date is in ISO 8601 and UTC
    customProperties Map<String>
    A list of key value pair of custom properties for the image resource.
    description String
    A human-friendly description.
    externalId String
    External entity Id on the provider side.
    id String
    links List<Property Map>
    HATEOAS of the entity.
    name String
    A human-friendly name used as an identifier for the image resource instance.
    orgId String
    The id of the organization this entity belongs to.
    osFamily String
    Operating System family of the image.
    owner String
    Email of the user that owns the entity.
    private Boolean
    Indicates whether this image is private. For vSphere, private images are considered to be templates and snapshots and public are Content Library Items.
    region String
    The region of the image. For a vSphere cloud account, it is the externalRegionId such as Datacenter:datacenter-2 and for an AWS cloud account, it is region name such as us-east-1, etc.
    updatedAt String
    Date when the entity was last updated. The date is ISO 8601 and UTC.
    filter String

    Supporting Types

    Href string
    Hrefs List<string>
    Rel string
    Href string
    Hrefs []string
    Rel string
    href String
    hrefs List<String>
    rel String
    href string
    hrefs string[]
    rel string
    href str
    hrefs Sequence[str]
    rel str
    href String
    hrefs List<String>
    rel String

    Package Details

    Repository
    vra vmware/terraform-provider-vra
    License
    Notes
    This Pulumi package is based on the vra Terraform Provider.
    vra logo
    vra 0.12.0 published on Monday, Apr 14, 2025 by vmware