1. Packages
  2. Vultr
  3. API Docs
  4. getInstances
Vultr v2.19.0 published on Friday, Jan 5, 2024 by dirien

vultr.getInstances

Explore with Pulumi AI

vultr logo
Vultr v2.19.0 published on Friday, Jan 5, 2024 by dirien

    List information for Vultr instances.

    Example Usage

    Get the information for all instances by

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vultr = Pulumi.Vultr;
    
    return await Deployment.RunAsync(() => 
    {
        var activeInstances = Vultr.GetInstances.Invoke(new()
        {
            Filters = new[]
            {
                new Vultr.Inputs.GetInstancesFilterInputArgs
                {
                    Name = "status",
                    Values = new[]
                    {
                        "active",
                    },
                },
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["instances"] = activeInstances.Apply(getInstancesResult => getInstancesResult.Instances).Select(__item => __item.Label).ToList(),
        };
    });
    
    package main
    
    import (
    	"github.com/dirien/pulumi-vultr/sdk/v2/go/vultr"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		activeInstances, err := vultr.GetInstances(ctx, &vultr.GetInstancesArgs{
    			Filters: []vultr.GetInstancesFilter{
    				{
    					Name: "status",
    					Values: []string{
    						"active",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		var splat0 []*string
    		for _, val0 := range activeInstances.Instances {
    			splat0 = append(splat0, val0.Label)
    		}
    		ctx.Export("instances", splat0)
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vultr.VultrFunctions;
    import com.pulumi.vultr.inputs.GetInstancesArgs;
    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 activeInstances = VultrFunctions.getInstances(GetInstancesArgs.builder()
                .filters(GetInstancesFilterArgs.builder()
                    .name("status")
                    .values("active")
                    .build())
                .build());
    
            ctx.export("instances", activeInstances.applyValue(getInstancesResult -> getInstancesResult.instances()).stream().map(element -> element.label()).collect(toList()));
        }
    }
    
    import pulumi
    import pulumi_vultr as vultr
    
    active_instances = vultr.get_instances(filters=[vultr.GetInstancesFilterArgs(
        name="status",
        values=["active"],
    )])
    pulumi.export("instances", [__item.label for __item in active_instances.instances])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as vultr from "@pulumi/vultr";
    
    const activeInstances = vultr.getInstances({
        filters: [{
            name: "status",
            values: ["active"],
        }],
    });
    export const instances = activeInstances.then(activeInstances => activeInstances.instances.map(__item => __item.label));
    

    Coming soon!

    Using getInstances

    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 getInstances(args: GetInstancesArgs, opts?: InvokeOptions): Promise<GetInstancesResult>
    function getInstancesOutput(args: GetInstancesOutputArgs, opts?: InvokeOptions): Output<GetInstancesResult>
    def get_instances(filters: Optional[Sequence[GetInstancesFilter]] = None,
                      opts: Optional[InvokeOptions] = None) -> GetInstancesResult
    def get_instances_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetInstancesFilterArgs]]]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetInstancesResult]
    func GetInstances(ctx *Context, args *GetInstancesArgs, opts ...InvokeOption) (*GetInstancesResult, error)
    func GetInstancesOutput(ctx *Context, args *GetInstancesOutputArgs, opts ...InvokeOption) GetInstancesResultOutput

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

    public static class GetInstances 
    {
        public static Task<GetInstancesResult> InvokeAsync(GetInstancesArgs args, InvokeOptions? opts = null)
        public static Output<GetInstancesResult> Invoke(GetInstancesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetInstancesResult> getInstances(GetInstancesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: vultr:index/getInstances:getInstances
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Filters List<ediri.Vultr.Inputs.GetInstancesFilter>
    Query parameters for finding instances.
    Filters []GetInstancesFilter
    Query parameters for finding instances.
    filters List<GetInstancesFilter>
    Query parameters for finding instances.
    filters GetInstancesFilter[]
    Query parameters for finding instances.
    filters Sequence[GetInstancesFilter]
    Query parameters for finding instances.
    filters List<Property Map>
    Query parameters for finding instances.

    getInstances Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Instances List<ediri.Vultr.Outputs.GetInstancesInstance>
    The list of instances which individually include the following:
    Filters List<ediri.Vultr.Outputs.GetInstancesFilter>
    Id string
    The provider-assigned unique ID for this managed resource.
    Instances []GetInstancesInstance
    The list of instances which individually include the following:
    Filters []GetInstancesFilter
    id String
    The provider-assigned unique ID for this managed resource.
    instances List<GetInstancesInstance>
    The list of instances which individually include the following:
    filters List<GetInstancesFilter>
    id string
    The provider-assigned unique ID for this managed resource.
    instances GetInstancesInstance[]
    The list of instances which individually include the following:
    filters GetInstancesFilter[]
    id str
    The provider-assigned unique ID for this managed resource.
    instances Sequence[GetInstancesInstance]
    The list of instances which individually include the following:
    filters Sequence[GetInstancesFilter]
    id String
    The provider-assigned unique ID for this managed resource.
    instances List<Property Map>
    The list of instances which individually include the following:
    filters List<Property Map>

    Supporting Types

    GetInstancesFilter

    Name string
    Attribute name to filter with.
    Values List<string>
    One or more values filter with.
    Name string
    Attribute name to filter with.
    Values []string
    One or more values filter with.
    name String
    Attribute name to filter with.
    values List<String>
    One or more values filter with.
    name string
    Attribute name to filter with.
    values string[]
    One or more values filter with.
    name str
    Attribute name to filter with.
    values Sequence[str]
    One or more values filter with.
    name String
    Attribute name to filter with.
    values List<String>
    One or more values filter with.

    GetInstancesInstance

    AllowedBandwidth int
    The server's allowed bandwidth usage in GB.
    AppId int
    The server's application ID.
    Backups string
    BackupsSchedule Dictionary<string, object>
    The current configuration for backups
    DateCreated string
    The date the server was added to your Vultr account.
    Disk int
    The description of the disk(s) on the server.
    Features List<string>
    Array of which features are enabled.
    FirewallGroupId string
    The ID of the firewall group applied to this server.
    GatewayV4 string
    The server's IPv4 gateway.
    Hostname string
    The hostname assigned to the server.
    Id string
    ImageId string
    The Marketplace ID for this application.
    InternalIp string
    The server's internal IP address.
    Kvm string
    The server's current KVM URL. This URL will change periodically. It is not advised to cache this value.
    Label string
    The server's label.
    Location string
    MainIp string
    The server's main IP address.
    NetmaskV4 string
    The server's IPv4 netmask.
    Os string
    The operating system of the instance.
    OsId int
    The server's operating system ID.
    Plan string
    The server's plan ID.
    PowerStatus string
    Whether the server is powered on or not.
    PrivateNetworkIds List<string>
    Ram int
    The amount of memory available on the instance in MB.
    Region string
    The region ID of the server.
    ServerStatus string
    A more detailed server status (none, locked, installingbooting, isomounting, ok).
    Status string
    The status of the server's subscription.
    Tags List<string>
    A list of tags applied to the instance.
    V6MainIp string
    The main IPv6 network address.
    V6Network string
    The IPv6 subnet.
    V6NetworkSize int
    The IPv6 network size in bits.
    VcpuCount int
    The number of virtual CPUs available on the server.
    VpcIds List<string>
    AllowedBandwidth int
    The server's allowed bandwidth usage in GB.
    AppId int
    The server's application ID.
    Backups string
    BackupsSchedule map[string]interface{}
    The current configuration for backups
    DateCreated string
    The date the server was added to your Vultr account.
    Disk int
    The description of the disk(s) on the server.
    Features []string
    Array of which features are enabled.
    FirewallGroupId string
    The ID of the firewall group applied to this server.
    GatewayV4 string
    The server's IPv4 gateway.
    Hostname string
    The hostname assigned to the server.
    Id string
    ImageId string
    The Marketplace ID for this application.
    InternalIp string
    The server's internal IP address.
    Kvm string
    The server's current KVM URL. This URL will change periodically. It is not advised to cache this value.
    Label string
    The server's label.
    Location string
    MainIp string
    The server's main IP address.
    NetmaskV4 string
    The server's IPv4 netmask.
    Os string
    The operating system of the instance.
    OsId int
    The server's operating system ID.
    Plan string
    The server's plan ID.
    PowerStatus string
    Whether the server is powered on or not.
    PrivateNetworkIds []string
    Ram int
    The amount of memory available on the instance in MB.
    Region string
    The region ID of the server.
    ServerStatus string
    A more detailed server status (none, locked, installingbooting, isomounting, ok).
    Status string
    The status of the server's subscription.
    Tags []string
    A list of tags applied to the instance.
    V6MainIp string
    The main IPv6 network address.
    V6Network string
    The IPv6 subnet.
    V6NetworkSize int
    The IPv6 network size in bits.
    VcpuCount int
    The number of virtual CPUs available on the server.
    VpcIds []string
    allowedBandwidth Integer
    The server's allowed bandwidth usage in GB.
    appId Integer
    The server's application ID.
    backups String
    backupsSchedule Map<String,Object>
    The current configuration for backups
    dateCreated String
    The date the server was added to your Vultr account.
    disk Integer
    The description of the disk(s) on the server.
    features List<String>
    Array of which features are enabled.
    firewallGroupId String
    The ID of the firewall group applied to this server.
    gatewayV4 String
    The server's IPv4 gateway.
    hostname String
    The hostname assigned to the server.
    id String
    imageId String
    The Marketplace ID for this application.
    internalIp String
    The server's internal IP address.
    kvm String
    The server's current KVM URL. This URL will change periodically. It is not advised to cache this value.
    label String
    The server's label.
    location String
    mainIp String
    The server's main IP address.
    netmaskV4 String
    The server's IPv4 netmask.
    os String
    The operating system of the instance.
    osId Integer
    The server's operating system ID.
    plan String
    The server's plan ID.
    powerStatus String
    Whether the server is powered on or not.
    privateNetworkIds List<String>
    ram Integer
    The amount of memory available on the instance in MB.
    region String
    The region ID of the server.
    serverStatus String
    A more detailed server status (none, locked, installingbooting, isomounting, ok).
    status String
    The status of the server's subscription.
    tags List<String>
    A list of tags applied to the instance.
    v6MainIp String
    The main IPv6 network address.
    v6Network String
    The IPv6 subnet.
    v6NetworkSize Integer
    The IPv6 network size in bits.
    vcpuCount Integer
    The number of virtual CPUs available on the server.
    vpcIds List<String>
    allowedBandwidth number
    The server's allowed bandwidth usage in GB.
    appId number
    The server's application ID.
    backups string
    backupsSchedule {[key: string]: any}
    The current configuration for backups
    dateCreated string
    The date the server was added to your Vultr account.
    disk number
    The description of the disk(s) on the server.
    features string[]
    Array of which features are enabled.
    firewallGroupId string
    The ID of the firewall group applied to this server.
    gatewayV4 string
    The server's IPv4 gateway.
    hostname string
    The hostname assigned to the server.
    id string
    imageId string
    The Marketplace ID for this application.
    internalIp string
    The server's internal IP address.
    kvm string
    The server's current KVM URL. This URL will change periodically. It is not advised to cache this value.
    label string
    The server's label.
    location string
    mainIp string
    The server's main IP address.
    netmaskV4 string
    The server's IPv4 netmask.
    os string
    The operating system of the instance.
    osId number
    The server's operating system ID.
    plan string
    The server's plan ID.
    powerStatus string
    Whether the server is powered on or not.
    privateNetworkIds string[]
    ram number
    The amount of memory available on the instance in MB.
    region string
    The region ID of the server.
    serverStatus string
    A more detailed server status (none, locked, installingbooting, isomounting, ok).
    status string
    The status of the server's subscription.
    tags string[]
    A list of tags applied to the instance.
    v6MainIp string
    The main IPv6 network address.
    v6Network string
    The IPv6 subnet.
    v6NetworkSize number
    The IPv6 network size in bits.
    vcpuCount number
    The number of virtual CPUs available on the server.
    vpcIds string[]
    allowed_bandwidth int
    The server's allowed bandwidth usage in GB.
    app_id int
    The server's application ID.
    backups str
    backups_schedule Mapping[str, Any]
    The current configuration for backups
    date_created str
    The date the server was added to your Vultr account.
    disk int
    The description of the disk(s) on the server.
    features Sequence[str]
    Array of which features are enabled.
    firewall_group_id str
    The ID of the firewall group applied to this server.
    gateway_v4 str
    The server's IPv4 gateway.
    hostname str
    The hostname assigned to the server.
    id str
    image_id str
    The Marketplace ID for this application.
    internal_ip str
    The server's internal IP address.
    kvm str
    The server's current KVM URL. This URL will change periodically. It is not advised to cache this value.
    label str
    The server's label.
    location str
    main_ip str
    The server's main IP address.
    netmask_v4 str
    The server's IPv4 netmask.
    os str
    The operating system of the instance.
    os_id int
    The server's operating system ID.
    plan str
    The server's plan ID.
    power_status str
    Whether the server is powered on or not.
    private_network_ids Sequence[str]
    ram int
    The amount of memory available on the instance in MB.
    region str
    The region ID of the server.
    server_status str
    A more detailed server status (none, locked, installingbooting, isomounting, ok).
    status str
    The status of the server's subscription.
    tags Sequence[str]
    A list of tags applied to the instance.
    v6_main_ip str
    The main IPv6 network address.
    v6_network str
    The IPv6 subnet.
    v6_network_size int
    The IPv6 network size in bits.
    vcpu_count int
    The number of virtual CPUs available on the server.
    vpc_ids Sequence[str]
    allowedBandwidth Number
    The server's allowed bandwidth usage in GB.
    appId Number
    The server's application ID.
    backups String
    backupsSchedule Map<Any>
    The current configuration for backups
    dateCreated String
    The date the server was added to your Vultr account.
    disk Number
    The description of the disk(s) on the server.
    features List<String>
    Array of which features are enabled.
    firewallGroupId String
    The ID of the firewall group applied to this server.
    gatewayV4 String
    The server's IPv4 gateway.
    hostname String
    The hostname assigned to the server.
    id String
    imageId String
    The Marketplace ID for this application.
    internalIp String
    The server's internal IP address.
    kvm String
    The server's current KVM URL. This URL will change periodically. It is not advised to cache this value.
    label String
    The server's label.
    location String
    mainIp String
    The server's main IP address.
    netmaskV4 String
    The server's IPv4 netmask.
    os String
    The operating system of the instance.
    osId Number
    The server's operating system ID.
    plan String
    The server's plan ID.
    powerStatus String
    Whether the server is powered on or not.
    privateNetworkIds List<String>
    ram Number
    The amount of memory available on the instance in MB.
    region String
    The region ID of the server.
    serverStatus String
    A more detailed server status (none, locked, installingbooting, isomounting, ok).
    status String
    The status of the server's subscription.
    tags List<String>
    A list of tags applied to the instance.
    v6MainIp String
    The main IPv6 network address.
    v6Network String
    The IPv6 subnet.
    v6NetworkSize Number
    The IPv6 network size in bits.
    vcpuCount Number
    The number of virtual CPUs available on the server.
    vpcIds List<String>

    Package Details

    Repository
    vultr dirien/pulumi-vultr
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vultr Terraform Provider.
    vultr logo
    Vultr v2.19.0 published on Friday, Jan 5, 2024 by dirien