Vultr v2.21.1 published on Monday, Jul 22, 2024 by dirien
vultr.getInstances
Explore with Pulumi AI
List information for Vultr instances.
Example Usage
Get the information for all instances by status
:
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));
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])
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
})
}
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 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()));
}
}
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. Get Instances Filter> - Query parameters for finding instances.
- Filters
[]Get
Instances Filter - Query parameters for finding instances.
- filters
List<Get
Instances Filter> - Query parameters for finding instances.
- filters
Get
Instances Filter[] - Query parameters for finding instances.
- filters
Sequence[Get
Instances Filter] - 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. Get Instances Instance> - The list of instances which individually include the following:
- Filters
List<ediri.
Vultr. Outputs. Get Instances Filter>
- Id string
- The provider-assigned unique ID for this managed resource.
- Instances
[]Get
Instances Instance - The list of instances which individually include the following:
- Filters
[]Get
Instances Filter
- id String
- The provider-assigned unique ID for this managed resource.
- instances
List<Get
Instances Instance> - The list of instances which individually include the following:
- filters
List<Get
Instances Filter>
- id string
- The provider-assigned unique ID for this managed resource.
- instances
Get
Instances Instance[] - The list of instances which individually include the following:
- filters
Get
Instances Filter[]
- id str
- The provider-assigned unique ID for this managed resource.
- instances
Sequence[Get
Instances Instance] - The list of instances which individually include the following:
- filters
Sequence[Get
Instances Filter]
- 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
GetInstancesInstance
- Allowed
Bandwidth int - The server's allowed bandwidth usage in GB.
- App
Id int - The server's application ID.
- Backups string
- Backups
Schedule Dictionary<string, object> - The current configuration for backups
- Date
Created 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.
- Firewall
Group stringId - The ID of the firewall group applied to this server.
- Gateway
V4 string - The server's IPv4 gateway.
- Hostname string
- The hostname assigned to the server.
- Id string
- Image
Id string - The Marketplace ID for this application.
- Internal
Ip 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
- Main
Ip string - The server's main IP address.
- Netmask
V4 string - The server's IPv4 netmask.
- Os string
- The operating system of the instance.
- Os
Id int - The server's operating system ID.
- Plan string
- The server's plan ID.
- Power
Status string - Whether the server is powered on or not.
- Private
Network List<string>Ids - Ram int
- The amount of memory available on the instance in MB.
- Region string
- The region ID of the server.
- Server
Status string - A more detailed server status (none, locked, installingbooting, isomounting, ok).
- Status string
- The status of the server's subscription.
- List<string>
- A list of tags applied to the instance.
- V6Main
Ip string - The main IPv6 network address.
- V6Network string
- The IPv6 subnet.
- V6Network
Size int - The IPv6 network size in bits.
- Vcpu
Count int - The number of virtual CPUs available on the server.
- Vpc
Ids List<string>
- Allowed
Bandwidth int - The server's allowed bandwidth usage in GB.
- App
Id int - The server's application ID.
- Backups string
- Backups
Schedule map[string]interface{} - The current configuration for backups
- Date
Created 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.
- Firewall
Group stringId - The ID of the firewall group applied to this server.
- Gateway
V4 string - The server's IPv4 gateway.
- Hostname string
- The hostname assigned to the server.
- Id string
- Image
Id string - The Marketplace ID for this application.
- Internal
Ip 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
- Main
Ip string - The server's main IP address.
- Netmask
V4 string - The server's IPv4 netmask.
- Os string
- The operating system of the instance.
- Os
Id int - The server's operating system ID.
- Plan string
- The server's plan ID.
- Power
Status string - Whether the server is powered on or not.
- Private
Network []stringIds - Ram int
- The amount of memory available on the instance in MB.
- Region string
- The region ID of the server.
- Server
Status string - A more detailed server status (none, locked, installingbooting, isomounting, ok).
- Status string
- The status of the server's subscription.
- []string
- A list of tags applied to the instance.
- V6Main
Ip string - The main IPv6 network address.
- V6Network string
- The IPv6 subnet.
- V6Network
Size int - The IPv6 network size in bits.
- Vcpu
Count int - The number of virtual CPUs available on the server.
- Vpc
Ids []string
- allowed
Bandwidth Integer - The server's allowed bandwidth usage in GB.
- app
Id Integer - The server's application ID.
- backups String
- backups
Schedule Map<String,Object> - The current configuration for backups
- date
Created 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.
- firewall
Group StringId - The ID of the firewall group applied to this server.
- gateway
V4 String - The server's IPv4 gateway.
- hostname String
- The hostname assigned to the server.
- id String
- image
Id String - The Marketplace ID for this application.
- internal
Ip 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
- main
Ip String - The server's main IP address.
- netmask
V4 String - The server's IPv4 netmask.
- os String
- The operating system of the instance.
- os
Id Integer - The server's operating system ID.
- plan String
- The server's plan ID.
- power
Status String - Whether the server is powered on or not.
- private
Network List<String>Ids - ram Integer
- The amount of memory available on the instance in MB.
- region String
- The region ID of the server.
- server
Status String - A more detailed server status (none, locked, installingbooting, isomounting, ok).
- status String
- The status of the server's subscription.
- List<String>
- A list of tags applied to the instance.
- v6Main
Ip String - The main IPv6 network address.
- v6Network String
- The IPv6 subnet.
- v6Network
Size Integer - The IPv6 network size in bits.
- vcpu
Count Integer - The number of virtual CPUs available on the server.
- vpc
Ids List<String>
- allowed
Bandwidth number - The server's allowed bandwidth usage in GB.
- app
Id number - The server's application ID.
- backups string
- backups
Schedule {[key: string]: any} - The current configuration for backups
- date
Created 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.
- firewall
Group stringId - The ID of the firewall group applied to this server.
- gateway
V4 string - The server's IPv4 gateway.
- hostname string
- The hostname assigned to the server.
- id string
- image
Id string - The Marketplace ID for this application.
- internal
Ip 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
- main
Ip string - The server's main IP address.
- netmask
V4 string - The server's IPv4 netmask.
- os string
- The operating system of the instance.
- os
Id number - The server's operating system ID.
- plan string
- The server's plan ID.
- power
Status string - Whether the server is powered on or not.
- private
Network string[]Ids - ram number
- The amount of memory available on the instance in MB.
- region string
- The region ID of the server.
- server
Status string - A more detailed server status (none, locked, installingbooting, isomounting, ok).
- status string
- The status of the server's subscription.
- string[]
- A list of tags applied to the instance.
- v6Main
Ip string - The main IPv6 network address.
- v6Network string
- The IPv6 subnet.
- v6Network
Size number - The IPv6 network size in bits.
- vcpu
Count number - The number of virtual CPUs available on the server.
- vpc
Ids 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_ strid - 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_ Sequence[str]ids - 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.
- Sequence[str]
- A list of tags applied to the instance.
- v6_
main_ strip - The main IPv6 network address.
- v6_
network str - The IPv6 subnet.
- v6_
network_ intsize - The IPv6 network size in bits.
- vcpu_
count int - The number of virtual CPUs available on the server.
- vpc_
ids Sequence[str]
- allowed
Bandwidth Number - The server's allowed bandwidth usage in GB.
- app
Id Number - The server's application ID.
- backups String
- backups
Schedule Map<Any> - The current configuration for backups
- date
Created 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.
- firewall
Group StringId - The ID of the firewall group applied to this server.
- gateway
V4 String - The server's IPv4 gateway.
- hostname String
- The hostname assigned to the server.
- id String
- image
Id String - The Marketplace ID for this application.
- internal
Ip 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
- main
Ip String - The server's main IP address.
- netmask
V4 String - The server's IPv4 netmask.
- os String
- The operating system of the instance.
- os
Id Number - The server's operating system ID.
- plan String
- The server's plan ID.
- power
Status String - Whether the server is powered on or not.
- private
Network List<String>Ids - ram Number
- The amount of memory available on the instance in MB.
- region String
- The region ID of the server.
- server
Status String - A more detailed server status (none, locked, installingbooting, isomounting, ok).
- status String
- The status of the server's subscription.
- List<String>
- A list of tags applied to the instance.
- v6Main
Ip String - The main IPv6 network address.
- v6Network String
- The IPv6 subnet.
- v6Network
Size Number - The IPv6 network size in bits.
- vcpu
Count Number - The number of virtual CPUs available on the server.
- vpc
Ids List<String>
Package Details
- Repository
- vultr dirien/pulumi-vultr
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
vultr
Terraform Provider.