vSphere
getDynamic
The vsphere.getDynamic
data source can be used to get the managed object
reference ID of any tagged managed object in vCenter
by providing a list of tag IDs and an optional regular expression to filter
objects by name.
Example Usage
using Pulumi;
using VSphere = Pulumi.VSphere;
class MyStack : Stack
{
public MyStack()
{
var cat = Output.Create(VSphere.GetTagCategory.InvokeAsync(new VSphere.GetTagCategoryArgs
{
Name = "SomeCategory",
}));
var tag1 = cat.Apply(cat => Output.Create(VSphere.GetTag.InvokeAsync(new VSphere.GetTagArgs
{
Name = "FirstTag",
CategoryId = cat.Id,
})));
var tag2 = cat.Apply(cat => Output.Create(VSphere.GetTag.InvokeAsync(new VSphere.GetTagArgs
{
Name = "SecondTag",
CategoryId = cat.Id,
})));
var dyn = Output.Tuple(tag1, tag1).Apply(values =>
{
var tag1 = values.Item1;
var tag11 = values.Item2;
return Output.Create(VSphere.GetDynamic.InvokeAsync(new VSphere.GetDynamicArgs
{
Filters =
{
tag1.Id,
tag11.Id,
},
NameRegex = "ubuntu",
Type = "Datacenter",
}));
});
}
}
Coming soon!
Coming soon!
import pulumi
import pulumi_vsphere as vsphere
cat = vsphere.get_tag_category(name="SomeCategory")
tag1 = vsphere.get_tag(name="FirstTag",
category_id=cat.id)
tag2 = vsphere.get_tag(name="SecondTag",
category_id=cat.id)
dyn = vsphere.get_dynamic(filters=[
tag1.id,
tag1.id,
],
name_regex="ubuntu",
type="Datacenter")
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";
const cat = vsphere.getTagCategory({
name: "SomeCategory",
});
const tag1 = cat.then(cat => vsphere.getTag({
name: "FirstTag",
categoryId: cat.id,
}));
const tag2 = cat.then(cat => vsphere.getTag({
name: "SecondTag",
categoryId: cat.id,
}));
const dyn = Promise.all([tag1, tag1]).then(([tag1, tag11]) => vsphere.getDynamic({
filters: [
tag1.id,
tag11.id,
],
nameRegex: "ubuntu",
type: "Datacenter",
}));
Coming soon!
Using getDynamic
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 getDynamic(args: GetDynamicArgs, opts?: InvokeOptions): Promise<GetDynamicResult>
function getDynamicOutput(args: GetDynamicOutputArgs, opts?: InvokeOptions): Output<GetDynamicResult>
def get_dynamic(filters: Optional[Sequence[str]] = None,
name_regex: Optional[str] = None,
type: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetDynamicResult
def get_dynamic_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
name_regex: Optional[pulumi.Input[str]] = None,
type: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetDynamicResult]
func GetDynamic(ctx *Context, args *GetDynamicArgs, opts ...InvokeOption) (*GetDynamicResult, error)
func GetDynamicOutput(ctx *Context, args *GetDynamicOutputArgs, opts ...InvokeOption) GetDynamicResultOutput
> Note: This function is named GetDynamic
in the Go SDK.
public static class GetDynamic
{
public static Task<GetDynamicResult> InvokeAsync(GetDynamicArgs args, InvokeOptions? opts = null)
public static Output<GetDynamicResult> Invoke(GetDynamicInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetDynamicResult> getDynamic(GetDynamicArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
Function: vsphere:index/getDynamic:getDynamic
Arguments:
# Arguments dictionary
The following arguments are supported:
- filters Sequence[str]
A list of tag IDs that must be present on an object to be a match.
- name_
regex str A regular expression that will be used to match the object's name.
- type str
The managed object type the returned object must match. For a full list, click here.
getDynamic Result
The following output properties are available:
- filters Sequence[str]
- id str
The provider-assigned unique ID for this managed resource.
- name_
regex str - type str
Package Details
- Repository
- https://github.com/pulumi/pulumi-vsphere
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
vsphere
Terraform Provider.