1. Packages
  2. Vcd Provider
  3. API Docs
  4. getCatalogItem
vcd 3.14.1 published on Monday, Apr 14, 2025 by vmware

vcd.getCatalogItem

Explore with Pulumi AI

vcd logo
vcd 3.14.1 published on Monday, Apr 14, 2025 by vmware

    If you only need vApp Template features, you may use vcd.CatalogVappTemplate instead.

    Provides a VMware Cloud Director Catalog item data source. A Catalog item can be used to reference a catalog item and use its data within other resources or data sources.

    Supported in provider v2.5+

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as vcd from "@pulumi/vcd";
    
    const my_first_item = vcd.getCatalogItem({
        org: "my-org",
        catalog: "my-cat",
        name: "my-first-item",
    });
    const my_second_item = new vcd.CatalogItem("my-second-item", {
        org: my_first_item.then(my_first_item => my_first_item.org),
        catalog: my_first_item.then(my_first_item => my_first_item.catalog),
        description: my_first_item.then(my_first_item => `Belongs to ${my_first_item.catalog}`),
        ovaPath: "/path/to/test_vapp_template.ova",
        uploadPieceSize: 5,
        metadata: my_first_item.then(my_first_item => my_first_item.metadata),
    });
    
    import pulumi
    import pulumi_vcd as vcd
    
    my_first_item = vcd.get_catalog_item(org="my-org",
        catalog="my-cat",
        name="my-first-item")
    my_second_item = vcd.CatalogItem("my-second-item",
        org=my_first_item.org,
        catalog=my_first_item.catalog,
        description=f"Belongs to {my_first_item.catalog}",
        ova_path="/path/to/test_vapp_template.ova",
        upload_piece_size=5,
        metadata=my_first_item.metadata)
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/vcd/v3/vcd"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		my_first_item, err := vcd.LookupCatalogItem(ctx, &vcd.LookupCatalogItemArgs{
    			Org:     pulumi.StringRef("my-org"),
    			Catalog: "my-cat",
    			Name:    pulumi.StringRef("my-first-item"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = vcd.NewCatalogItem(ctx, "my-second-item", &vcd.CatalogItemArgs{
    			Org:             pulumi.String(my_first_item.Org),
    			Catalog:         pulumi.String(my_first_item.Catalog),
    			Description:     pulumi.Sprintf("Belongs to %v", my_first_item.Catalog),
    			OvaPath:         pulumi.String("/path/to/test_vapp_template.ova"),
    			UploadPieceSize: pulumi.Float64(5),
    			Metadata:        pulumi.StringMap(my_first_item.Metadata),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vcd = Pulumi.Vcd;
    
    return await Deployment.RunAsync(() => 
    {
        var my_first_item = Vcd.GetCatalogItem.Invoke(new()
        {
            Org = "my-org",
            Catalog = "my-cat",
            Name = "my-first-item",
        });
    
        var my_second_item = new Vcd.CatalogItem("my-second-item", new()
        {
            Org = my_first_item.Apply(my_first_item => my_first_item.Apply(getCatalogItemResult => getCatalogItemResult.Org)),
            Catalog = my_first_item.Apply(my_first_item => my_first_item.Apply(getCatalogItemResult => getCatalogItemResult.Catalog)),
            Description = my_first_item.Apply(my_first_item => $"Belongs to {my_first_item.Apply(getCatalogItemResult => getCatalogItemResult.Catalog)}"),
            OvaPath = "/path/to/test_vapp_template.ova",
            UploadPieceSize = 5,
            Metadata = my_first_item.Apply(my_first_item => my_first_item.Apply(getCatalogItemResult => getCatalogItemResult.Metadata)),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vcd.VcdFunctions;
    import com.pulumi.vcd.inputs.GetCatalogItemArgs;
    import com.pulumi.vcd.CatalogItem;
    import com.pulumi.vcd.CatalogItemArgs;
    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 my-first-item = VcdFunctions.getCatalogItem(GetCatalogItemArgs.builder()
                .org("my-org")
                .catalog("my-cat")
                .name("my-first-item")
                .build());
    
            var my_second_item = new CatalogItem("my-second-item", CatalogItemArgs.builder()
                .org(my_first_item.org())
                .catalog(my_first_item.catalog())
                .description(String.format("Belongs to %s", my_first_item.catalog()))
                .ovaPath("/path/to/test_vapp_template.ova")
                .uploadPieceSize(5)
                .metadata(my_first_item.metadata())
                .build());
    
        }
    }
    
    resources:
      my-second-item:
        type: vcd:CatalogItem
        properties:
          # Using the data source, two properties from another catalog items are
          #   # used in this resource.
          #   # You can read it as "use the org from catalog item `my-first-item`"
          #   # and "use the catalog from catalog item `my-first-item`"
          org: ${["my-first-item"].org}
          catalog: ${["my-first-item"].catalog}
          # The description uses the data source to create a dynamic text
          #   # The description will become "Belongs to my-cat"
          description: Belongs to ${["my-first-item"].catalog}
          ovaPath: /path/to/test_vapp_template.ova
          uploadPieceSize: 5
          metadata: ${["my-first-item"].metadata}
    variables:
      my-first-item:
        fn::invoke:
          function: vcd:getCatalogItem
          arguments:
            org: my-org
            catalog: my-cat
            name: my-first-item
    

    Metadata

    The metadata_entry (v3.8+) is a set of metadata entries that have the following structure:

    • key - Key of this metadata entry.
    • value - Value of this metadata entry.
    • type - Type of this metadata entry. One of: MetadataStringValue, MetadataNumberValue, MetadataDateTimeValue, MetadataBooleanValue.
    • user_access - User access level for this metadata entry. One of: PRIVATE (hidden), READONLY (read only), READWRITE (read/write).
    • is_system - Domain for this metadata entry. true if it belongs to SYSTEM, false if it belongs to GENERAL.

    Filter arguments

    (Supported in provider v2.9+)

    • name_regex - (Optional) matches the name using a regular expression.
    • date - (Optional) is an expression starting with an operator (>, <, >=, <=, ==), followed by a date, with optional spaces in between. For example: > 2020-02-01 12:35:00.523Z The filter recognizes several formats, but one of yyyy-mm-dd [hh:mm[:ss[.nnnZ]]] or dd-MMM-yyyy [hh:mm[:ss[.nnnZ]]] is recommended. Comparison with equality operator (==) need to define the date to the microseconds.
    • latest - (Optional) If true, retrieve the latest item among the ones matching other parameters. If no other parameters are set, it retrieves the newest item.
    • earliest - (Optional) If true, retrieve the earliest item among the ones matching other parameters. If no other parameters are set, it retrieves the oldest item.
    • metadata - (Optional) One or more parameters that will match metadata contents.

    See Filters reference for details and examples.

    Using getCatalogItem

    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 getCatalogItem(args: GetCatalogItemArgs, opts?: InvokeOptions): Promise<GetCatalogItemResult>
    function getCatalogItemOutput(args: GetCatalogItemOutputArgs, opts?: InvokeOptions): Output<GetCatalogItemResult>
    def get_catalog_item(catalog: Optional[str] = None,
                         filter: Optional[GetCatalogItemFilter] = None,
                         id: Optional[str] = None,
                         name: Optional[str] = None,
                         org: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetCatalogItemResult
    def get_catalog_item_output(catalog: Optional[pulumi.Input[str]] = None,
                         filter: Optional[pulumi.Input[GetCatalogItemFilterArgs]] = None,
                         id: Optional[pulumi.Input[str]] = None,
                         name: Optional[pulumi.Input[str]] = None,
                         org: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetCatalogItemResult]
    func LookupCatalogItem(ctx *Context, args *LookupCatalogItemArgs, opts ...InvokeOption) (*LookupCatalogItemResult, error)
    func LookupCatalogItemOutput(ctx *Context, args *LookupCatalogItemOutputArgs, opts ...InvokeOption) LookupCatalogItemResultOutput

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

    public static class GetCatalogItem 
    {
        public static Task<GetCatalogItemResult> InvokeAsync(GetCatalogItemArgs args, InvokeOptions? opts = null)
        public static Output<GetCatalogItemResult> Invoke(GetCatalogItemInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetCatalogItemResult> getCatalogItem(GetCatalogItemArgs args, InvokeOptions options)
    public static Output<GetCatalogItemResult> getCatalogItem(GetCatalogItemArgs args, InvokeOptions options)
    
    fn::invoke:
      function: vcd:index/getCatalogItem:getCatalogItem
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Catalog string
    Catalog name
    Filter GetCatalogItemFilter
    Retrieves the data source using one or more filter parameters
    Id string
    Name string
    Catalog Item name (optional when filter is used)
    Org string
    Org name
    Catalog string
    Catalog name
    Filter GetCatalogItemFilter
    Retrieves the data source using one or more filter parameters
    Id string
    Name string
    Catalog Item name (optional when filter is used)
    Org string
    Org name
    catalog String
    Catalog name
    filter GetCatalogItemFilter
    Retrieves the data source using one or more filter parameters
    id String
    name String
    Catalog Item name (optional when filter is used)
    org String
    Org name
    catalog string
    Catalog name
    filter GetCatalogItemFilter
    Retrieves the data source using one or more filter parameters
    id string
    name string
    Catalog Item name (optional when filter is used)
    org string
    Org name
    catalog str
    Catalog name
    filter GetCatalogItemFilter
    Retrieves the data source using one or more filter parameters
    id str
    name str
    Catalog Item name (optional when filter is used)
    org str
    Org name
    catalog String
    Catalog name
    filter Property Map
    Retrieves the data source using one or more filter parameters
    id String
    name String
    Catalog Item name (optional when filter is used)
    org String
    Org name

    getCatalogItem Result

    The following output properties are available:

    Catalog string
    CatalogItemMetadata Dictionary<string, string>
    (Deprecated) Use metadata_entry instead. Key value map of metadata assigned to the catalog item.
    Created string
    Description string
    Catalog item description.
    Id string
    Metadata Dictionary<string, string>
    Key value map of metadata assigned to the associated vApp template.

    Deprecated: Deprecated

    MetadataEntries List<GetCatalogItemMetadataEntry>
    A set of metadata entries assigned to the catalog item. See Metadata section for details.
    Filter GetCatalogItemFilter
    Name string
    Org string
    Catalog string
    CatalogItemMetadata map[string]string
    (Deprecated) Use metadata_entry instead. Key value map of metadata assigned to the catalog item.
    Created string
    Description string
    Catalog item description.
    Id string
    Metadata map[string]string
    Key value map of metadata assigned to the associated vApp template.

    Deprecated: Deprecated

    MetadataEntries []GetCatalogItemMetadataEntry
    A set of metadata entries assigned to the catalog item. See Metadata section for details.
    Filter GetCatalogItemFilter
    Name string
    Org string
    catalog String
    catalogItemMetadata Map<String,String>
    (Deprecated) Use metadata_entry instead. Key value map of metadata assigned to the catalog item.
    created String
    description String
    Catalog item description.
    id String
    metadata Map<String,String>
    Key value map of metadata assigned to the associated vApp template.

    Deprecated: Deprecated

    metadataEntries List<GetCatalogItemMetadataEntry>
    A set of metadata entries assigned to the catalog item. See Metadata section for details.
    filter GetCatalogItemFilter
    name String
    org String
    catalog string
    catalogItemMetadata {[key: string]: string}
    (Deprecated) Use metadata_entry instead. Key value map of metadata assigned to the catalog item.
    created string
    description string
    Catalog item description.
    id string
    metadata {[key: string]: string}
    Key value map of metadata assigned to the associated vApp template.

    Deprecated: Deprecated

    metadataEntries GetCatalogItemMetadataEntry[]
    A set of metadata entries assigned to the catalog item. See Metadata section for details.
    filter GetCatalogItemFilter
    name string
    org string
    catalog str
    catalog_item_metadata Mapping[str, str]
    (Deprecated) Use metadata_entry instead. Key value map of metadata assigned to the catalog item.
    created str
    description str
    Catalog item description.
    id str
    metadata Mapping[str, str]
    Key value map of metadata assigned to the associated vApp template.

    Deprecated: Deprecated

    metadata_entries Sequence[GetCatalogItemMetadataEntry]
    A set of metadata entries assigned to the catalog item. See Metadata section for details.
    filter GetCatalogItemFilter
    name str
    org str
    catalog String
    catalogItemMetadata Map<String>
    (Deprecated) Use metadata_entry instead. Key value map of metadata assigned to the catalog item.
    created String
    description String
    Catalog item description.
    id String
    metadata Map<String>
    Key value map of metadata assigned to the associated vApp template.

    Deprecated: Deprecated

    metadataEntries List<Property Map>
    A set of metadata entries assigned to the catalog item. See Metadata section for details.
    filter Property Map
    name String
    org String

    Supporting Types

    GetCatalogItemFilter

    Date string
    Search by date comparison ({>|>=|<|<=|==} yyyy-mm-dd[ hh[:mm[:ss]]])
    Earliest bool
    Retrieves the oldest item
    Latest bool
    Retrieves the newest item
    Metadatas List<GetCatalogItemFilterMetadata>
    Key value map of metadata assigned to the associated vApp template.
    NameRegex string
    Search by name with a regular expression
    Date string
    Search by date comparison ({>|>=|<|<=|==} yyyy-mm-dd[ hh[:mm[:ss]]])
    Earliest bool
    Retrieves the oldest item
    Latest bool
    Retrieves the newest item
    Metadatas []GetCatalogItemFilterMetadata
    Key value map of metadata assigned to the associated vApp template.
    NameRegex string
    Search by name with a regular expression
    date String
    Search by date comparison ({>|>=|<|<=|==} yyyy-mm-dd[ hh[:mm[:ss]]])
    earliest Boolean
    Retrieves the oldest item
    latest Boolean
    Retrieves the newest item
    metadatas List<GetCatalogItemFilterMetadata>
    Key value map of metadata assigned to the associated vApp template.
    nameRegex String
    Search by name with a regular expression
    date string
    Search by date comparison ({>|>=|<|<=|==} yyyy-mm-dd[ hh[:mm[:ss]]])
    earliest boolean
    Retrieves the oldest item
    latest boolean
    Retrieves the newest item
    metadatas GetCatalogItemFilterMetadata[]
    Key value map of metadata assigned to the associated vApp template.
    nameRegex string
    Search by name with a regular expression
    date str
    Search by date comparison ({>|>=|<|<=|==} yyyy-mm-dd[ hh[:mm[:ss]]])
    earliest bool
    Retrieves the oldest item
    latest bool
    Retrieves the newest item
    metadatas Sequence[GetCatalogItemFilterMetadata]
    Key value map of metadata assigned to the associated vApp template.
    name_regex str
    Search by name with a regular expression
    date String
    Search by date comparison ({>|>=|<|<=|==} yyyy-mm-dd[ hh[:mm[:ss]]])
    earliest Boolean
    Retrieves the oldest item
    latest Boolean
    Retrieves the newest item
    metadatas List<Property Map>
    Key value map of metadata assigned to the associated vApp template.
    nameRegex String
    Search by name with a regular expression

    GetCatalogItemFilterMetadata

    Key string
    Metadata key (field name)
    Value string
    Metadata value (can be a regular expression if "use_api_search" is false)
    IsSystem bool
    True if is a metadata@SYSTEM key
    Type string
    Type of metadata value (needed only if "use_api_search" is true)
    UseApiSearch bool
    If true, will search the vCD using native metadata query (without regular expressions)
    Key string
    Metadata key (field name)
    Value string
    Metadata value (can be a regular expression if "use_api_search" is false)
    IsSystem bool
    True if is a metadata@SYSTEM key
    Type string
    Type of metadata value (needed only if "use_api_search" is true)
    UseApiSearch bool
    If true, will search the vCD using native metadata query (without regular expressions)
    key String
    Metadata key (field name)
    value String
    Metadata value (can be a regular expression if "use_api_search" is false)
    isSystem Boolean
    True if is a metadata@SYSTEM key
    type String
    Type of metadata value (needed only if "use_api_search" is true)
    useApiSearch Boolean
    If true, will search the vCD using native metadata query (without regular expressions)
    key string
    Metadata key (field name)
    value string
    Metadata value (can be a regular expression if "use_api_search" is false)
    isSystem boolean
    True if is a metadata@SYSTEM key
    type string
    Type of metadata value (needed only if "use_api_search" is true)
    useApiSearch boolean
    If true, will search the vCD using native metadata query (without regular expressions)
    key str
    Metadata key (field name)
    value str
    Metadata value (can be a regular expression if "use_api_search" is false)
    is_system bool
    True if is a metadata@SYSTEM key
    type str
    Type of metadata value (needed only if "use_api_search" is true)
    use_api_search bool
    If true, will search the vCD using native metadata query (without regular expressions)
    key String
    Metadata key (field name)
    value String
    Metadata value (can be a regular expression if "use_api_search" is false)
    isSystem Boolean
    True if is a metadata@SYSTEM key
    type String
    Type of metadata value (needed only if "use_api_search" is true)
    useApiSearch Boolean
    If true, will search the vCD using native metadata query (without regular expressions)

    GetCatalogItemMetadataEntry

    IsSystem bool
    Key string
    Type string
    UserAccess string
    Value string
    IsSystem bool
    Key string
    Type string
    UserAccess string
    Value string
    isSystem Boolean
    key String
    type String
    userAccess String
    value String
    isSystem boolean
    key string
    type string
    userAccess string
    value string
    isSystem Boolean
    key String
    type String
    userAccess String
    value String

    Package Details

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