vcd.getCatalogItem
Explore with Pulumi AI
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 toSYSTEM
, false if it belongs toGENERAL
.
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 ofyyyy-mm-dd [hh:mm[:ss[.nnnZ]]]
ordd-MMM-yyyy [hh:mm[:ss[.nnnZ]]]
is recommended. Comparison with equality operator (==
) need to define the date to the microseconds.latest
- (Optional) Iftrue
, retrieve the latest item among the ones matching other parameters. If no other parameters are set, it retrieves the newest item.earliest
- (Optional) Iftrue
, 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:
getCatalogItem Result
The following output properties are available:
- Catalog string
- Catalog
Item Dictionary<string, string>Metadata - (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.
- Metadata
Entries List<GetCatalog Item Metadata Entry> - A set of metadata entries assigned to the catalog item. See Metadata section for details.
- Filter
Get
Catalog Item Filter - Name string
- Org string
- Catalog string
- Catalog
Item map[string]stringMetadata - (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.
- Metadata
Entries []GetCatalog Item Metadata Entry - A set of metadata entries assigned to the catalog item. See Metadata section for details.
- Filter
Get
Catalog Item Filter - Name string
- Org string
- catalog String
- catalog
Item Map<String,String>Metadata - (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.
- metadata
Entries List<GetCatalog Item Metadata Entry> - A set of metadata entries assigned to the catalog item. See Metadata section for details.
- filter
Get
Catalog Item Filter - name String
- org String
- catalog string
- catalog
Item {[key: string]: string}Metadata - (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.
- metadata
Entries GetCatalog Item Metadata Entry[] - A set of metadata entries assigned to the catalog item. See Metadata section for details.
- filter
Get
Catalog Item Filter - name string
- org string
- catalog str
- catalog_
item_ Mapping[str, str]metadata - (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.
- metadata_
entries Sequence[GetCatalog Item Metadata Entry] - A set of metadata entries assigned to the catalog item. See Metadata section for details.
- filter
Get
Catalog Item Filter - name str
- org str
- catalog String
- catalog
Item Map<String>Metadata - (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.
- metadata
Entries 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<Get
Catalog Item Filter Metadata> - Key value map of metadata assigned to the associated vApp template.
- Name
Regex 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
[]Get
Catalog Item Filter Metadata - Key value map of metadata assigned to the associated vApp template.
- Name
Regex 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<Get
Catalog Item Filter Metadata> - Key value map of metadata assigned to the associated vApp template.
- name
Regex 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
Get
Catalog Item Filter Metadata[] - Key value map of metadata assigned to the associated vApp template.
- name
Regex 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[Get
Catalog Item Filter Metadata] - 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.
- name
Regex 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)
- Is
System bool - True if is a metadata@SYSTEM key
- Type string
- Type of metadata value (needed only if "use_api_search" is true)
- Use
Api boolSearch - 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)
- Is
System bool - True if is a metadata@SYSTEM key
- Type string
- Type of metadata value (needed only if "use_api_search" is true)
- Use
Api boolSearch - 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)
- is
System Boolean - True if is a metadata@SYSTEM key
- type String
- Type of metadata value (needed only if "use_api_search" is true)
- use
Api BooleanSearch - 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)
- is
System boolean - True if is a metadata@SYSTEM key
- type string
- Type of metadata value (needed only if "use_api_search" is true)
- use
Api booleanSearch - 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_ boolsearch - 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)
- is
System Boolean - True if is a metadata@SYSTEM key
- type String
- Type of metadata value (needed only if "use_api_search" is true)
- use
Api BooleanSearch - If true, will search the vCD using native metadata query (without regular expressions)
GetCatalogItemMetadataEntry
- Is
System bool - Key string
- Type string
- User
Access string - Value string
- Is
System bool - Key string
- Type string
- User
Access string - Value string
- is
System Boolean - key String
- type String
- user
Access String - value String
- is
System boolean - key string
- type string
- user
Access string - value string
- is_
system bool - key str
- type str
- user_
access str - value str
- is
System Boolean - key String
- type String
- user
Access String - value String
Package Details
- Repository
- vcd vmware/terraform-provider-vcd
- License
- Notes
- This Pulumi package is based on the
vcd
Terraform Provider.