Civo v2.4.6 published on Wednesday, Nov 6, 2024 by Pulumi
civo.getInstances
Explore with Pulumi AI
Get information on instances for use in other resources, with the ability to filter and sort the results. If no filters are specified, all instances will be returned.
Note: You can use the civo.Instance
data source to obtain metadata about a single instance if you already know the id, unique hostname, or unique tag to retrieve.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as civo from "@pulumi/civo";
const small-size = civo.getInstances({
region: "LON1",
filters: [{
key: "size",
values: [small],
}],
});
import pulumi
import pulumi_civo as civo
small_size = civo.get_instances(region="LON1",
filters=[{
"key": "size",
"values": [small],
}])
package main
import (
"github.com/pulumi/pulumi-civo/sdk/v2/go/civo"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := civo.GetInstances(ctx, &civo.GetInstancesArgs{
Region: pulumi.StringRef("LON1"),
Filters: []civo.GetInstancesFilter{
{
Key: "size",
Values: interface{}{
small,
},
},
},
}, nil);
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Civo = Pulumi.Civo;
return await Deployment.RunAsync(() =>
{
var small_size = Civo.GetInstances.Invoke(new()
{
Region = "LON1",
Filters = new[]
{
new Civo.Inputs.GetInstancesFilterInputArgs
{
Key = "size",
Values = new[]
{
small,
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.civo.CivoFunctions;
import com.pulumi.civo.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 small-size = CivoFunctions.getInstances(GetInstancesArgs.builder()
.region("LON1")
.filters(GetInstancesFilterArgs.builder()
.key("size")
.values(small)
.build())
.build());
}
}
variables:
small-size:
fn::invoke:
Function: civo:getInstances
Arguments:
region: LON1
filters:
- key: size
values:
- ${small}
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,
region: Optional[str] = None,
sorts: Optional[Sequence[GetInstancesSort]] = None,
opts: Optional[InvokeOptions] = None) -> GetInstancesResult
def get_instances_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetInstancesFilterArgs]]]] = None,
region: Optional[pulumi.Input[str]] = None,
sorts: Optional[pulumi.Input[Sequence[pulumi.Input[GetInstancesSortArgs]]]] = 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: civo:index/getInstances:getInstances
arguments:
# arguments dictionary
The following arguments are supported:
- Filters
List<Get
Instances Filter> - One or more key/value pairs on which to filter results
- Region string
- If used, all instances will be from the provided region
- Sorts
List<Get
Instances Sort> - One or more key/direction pairs on which to sort results
- Filters
[]Get
Instances Filter - One or more key/value pairs on which to filter results
- Region string
- If used, all instances will be from the provided region
- Sorts
[]Get
Instances Sort - One or more key/direction pairs on which to sort results
- filters
List<Get
Instances Filter> - One or more key/value pairs on which to filter results
- region String
- If used, all instances will be from the provided region
- sorts
List<Get
Instances Sort> - One or more key/direction pairs on which to sort results
- filters
Get
Instances Filter[] - One or more key/value pairs on which to filter results
- region string
- If used, all instances will be from the provided region
- sorts
Get
Instances Sort[] - One or more key/direction pairs on which to sort results
- filters
Sequence[Get
Instances Filter] - One or more key/value pairs on which to filter results
- region str
- If used, all instances will be from the provided region
- sorts
Sequence[Get
Instances Sort] - One or more key/direction pairs on which to sort results
- filters List<Property Map>
- One or more key/value pairs on which to filter results
- region String
- If used, all instances will be from the provided region
- sorts List<Property Map>
- One or more key/direction pairs on which to sort results
getInstances Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Instances
List<Get
Instances Instance> - Filters
List<Get
Instances Filter> - One or more key/value pairs on which to filter results
- Region string
- If used, all instances will be from the provided region
- Sorts
List<Get
Instances Sort> - One or more key/direction pairs on which to sort results
- Id string
- The provider-assigned unique ID for this managed resource.
- Instances
[]Get
Instances Instance - Filters
[]Get
Instances Filter - One or more key/value pairs on which to filter results
- Region string
- If used, all instances will be from the provided region
- Sorts
[]Get
Instances Sort - One or more key/direction pairs on which to sort results
- id String
- The provider-assigned unique ID for this managed resource.
- instances
List<Get
Instances Instance> - filters
List<Get
Instances Filter> - One or more key/value pairs on which to filter results
- region String
- If used, all instances will be from the provided region
- sorts
List<Get
Instances Sort> - One or more key/direction pairs on which to sort results
- id string
- The provider-assigned unique ID for this managed resource.
- instances
Get
Instances Instance[] - filters
Get
Instances Filter[] - One or more key/value pairs on which to filter results
- region string
- If used, all instances will be from the provided region
- sorts
Get
Instances Sort[] - One or more key/direction pairs on which to sort results
- id str
- The provider-assigned unique ID for this managed resource.
- instances
Sequence[Get
Instances Instance] - filters
Sequence[Get
Instances Filter] - One or more key/value pairs on which to filter results
- region str
- If used, all instances will be from the provided region
- sorts
Sequence[Get
Instances Sort] - One or more key/direction pairs on which to sort results
- id String
- The provider-assigned unique ID for this managed resource.
- instances List<Property Map>
- filters List<Property Map>
- One or more key/value pairs on which to filter results
- region String
- If used, all instances will be from the provided region
- sorts List<Property Map>
- One or more key/direction pairs on which to sort results
Supporting Types
GetInstancesFilter
- Key string
- Filter instances by this key. This may be one of
cpu_cores
,created_at
,disk_gb
,firewall_id
,hostname
,id
,initial_password
,initial_user
,network_id
,notes
,private_ip
,pseudo_ip
,public_ip
,ram_mb
,region
,reverse_dns
,script
,size
,sshkey_id
,status
,tags
,template
. - Values List<string>
- Only retrieves
instances
which keys has value that matches one of the values provided here - All bool
- Set to
true
to require that a field match all of thevalues
instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of thevalues
are present in the list or set. - Match
By string - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field.
- Key string
- Filter instances by this key. This may be one of
cpu_cores
,created_at
,disk_gb
,firewall_id
,hostname
,id
,initial_password
,initial_user
,network_id
,notes
,private_ip
,pseudo_ip
,public_ip
,ram_mb
,region
,reverse_dns
,script
,size
,sshkey_id
,status
,tags
,template
. - Values []string
- Only retrieves
instances
which keys has value that matches one of the values provided here - All bool
- Set to
true
to require that a field match all of thevalues
instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of thevalues
are present in the list or set. - Match
By string - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field.
- key String
- Filter instances by this key. This may be one of
cpu_cores
,created_at
,disk_gb
,firewall_id
,hostname
,id
,initial_password
,initial_user
,network_id
,notes
,private_ip
,pseudo_ip
,public_ip
,ram_mb
,region
,reverse_dns
,script
,size
,sshkey_id
,status
,tags
,template
. - values List<String>
- Only retrieves
instances
which keys has value that matches one of the values provided here - all Boolean
- Set to
true
to require that a field match all of thevalues
instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of thevalues
are present in the list or set. - match
By String - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field.
- key string
- Filter instances by this key. This may be one of
cpu_cores
,created_at
,disk_gb
,firewall_id
,hostname
,id
,initial_password
,initial_user
,network_id
,notes
,private_ip
,pseudo_ip
,public_ip
,ram_mb
,region
,reverse_dns
,script
,size
,sshkey_id
,status
,tags
,template
. - values string[]
- Only retrieves
instances
which keys has value that matches one of the values provided here - all boolean
- Set to
true
to require that a field match all of thevalues
instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of thevalues
are present in the list or set. - match
By string - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field.
- key str
- Filter instances by this key. This may be one of
cpu_cores
,created_at
,disk_gb
,firewall_id
,hostname
,id
,initial_password
,initial_user
,network_id
,notes
,private_ip
,pseudo_ip
,public_ip
,ram_mb
,region
,reverse_dns
,script
,size
,sshkey_id
,status
,tags
,template
. - values Sequence[str]
- Only retrieves
instances
which keys has value that matches one of the values provided here - all bool
- Set to
true
to require that a field match all of thevalues
instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of thevalues
are present in the list or set. - match_
by str - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field.
- key String
- Filter instances by this key. This may be one of
cpu_cores
,created_at
,disk_gb
,firewall_id
,hostname
,id
,initial_password
,initial_user
,network_id
,notes
,private_ip
,pseudo_ip
,public_ip
,ram_mb
,region
,reverse_dns
,script
,size
,sshkey_id
,status
,tags
,template
. - values List<String>
- Only retrieves
instances
which keys has value that matches one of the values provided here - all Boolean
- Set to
true
to require that a field match all of thevalues
instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of thevalues
are present in the list or set. - match
By String - One of
exact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field.
GetInstancesInstance
- Cpu
Cores int - CPU of the instance
- Created
At string - Creation date of the instance
- Disk
Gb int - SSD size of the instance
- Firewall
Id string - Firewall ID of the instance
- Hostname string
- Hostname of the instance
- Id string
- ID of the instance
- Initial
Password string - Initial password of the instance
- Initial
User string - Initial user of the instance
- Network
Id string - Network id of the instance
- Notes string
- Note of the instance
- Private
Ip string - Private IP of the instance
- Pseudo
Ip string - Pseudo IP of the instance
- Public
Ip string - Public IP of the instance
- Ram
Mb int - RAM of the instance
- Region string
- Region of the instance
- Reverse
Dns string - Reverse DNS of the instance
- Script string
- Script of the instance
- Size string
- Size of the instance
- Sshkey
Id string - SSH key id of the instance
- Status string
- Status of the instance
- List<string>
- Tags of the instance
- Template string
- Disk image/template of the instance
- Cpu
Cores int - CPU of the instance
- Created
At string - Creation date of the instance
- Disk
Gb int - SSD size of the instance
- Firewall
Id string - Firewall ID of the instance
- Hostname string
- Hostname of the instance
- Id string
- ID of the instance
- Initial
Password string - Initial password of the instance
- Initial
User string - Initial user of the instance
- Network
Id string - Network id of the instance
- Notes string
- Note of the instance
- Private
Ip string - Private IP of the instance
- Pseudo
Ip string - Pseudo IP of the instance
- Public
Ip string - Public IP of the instance
- Ram
Mb int - RAM of the instance
- Region string
- Region of the instance
- Reverse
Dns string - Reverse DNS of the instance
- Script string
- Script of the instance
- Size string
- Size of the instance
- Sshkey
Id string - SSH key id of the instance
- Status string
- Status of the instance
- []string
- Tags of the instance
- Template string
- Disk image/template of the instance
- cpu
Cores Integer - CPU of the instance
- created
At String - Creation date of the instance
- disk
Gb Integer - SSD size of the instance
- firewall
Id String - Firewall ID of the instance
- hostname String
- Hostname of the instance
- id String
- ID of the instance
- initial
Password String - Initial password of the instance
- initial
User String - Initial user of the instance
- network
Id String - Network id of the instance
- notes String
- Note of the instance
- private
Ip String - Private IP of the instance
- pseudo
Ip String - Pseudo IP of the instance
- public
Ip String - Public IP of the instance
- ram
Mb Integer - RAM of the instance
- region String
- Region of the instance
- reverse
Dns String - Reverse DNS of the instance
- script String
- Script of the instance
- size String
- Size of the instance
- sshkey
Id String - SSH key id of the instance
- status String
- Status of the instance
- List<String>
- Tags of the instance
- template String
- Disk image/template of the instance
- cpu
Cores number - CPU of the instance
- created
At string - Creation date of the instance
- disk
Gb number - SSD size of the instance
- firewall
Id string - Firewall ID of the instance
- hostname string
- Hostname of the instance
- id string
- ID of the instance
- initial
Password string - Initial password of the instance
- initial
User string - Initial user of the instance
- network
Id string - Network id of the instance
- notes string
- Note of the instance
- private
Ip string - Private IP of the instance
- pseudo
Ip string - Pseudo IP of the instance
- public
Ip string - Public IP of the instance
- ram
Mb number - RAM of the instance
- region string
- Region of the instance
- reverse
Dns string - Reverse DNS of the instance
- script string
- Script of the instance
- size string
- Size of the instance
- sshkey
Id string - SSH key id of the instance
- status string
- Status of the instance
- string[]
- Tags of the instance
- template string
- Disk image/template of the instance
- cpu_
cores int - CPU of the instance
- created_
at str - Creation date of the instance
- disk_
gb int - SSD size of the instance
- firewall_
id str - Firewall ID of the instance
- hostname str
- Hostname of the instance
- id str
- ID of the instance
- initial_
password str - Initial password of the instance
- initial_
user str - Initial user of the instance
- network_
id str - Network id of the instance
- notes str
- Note of the instance
- private_
ip str - Private IP of the instance
- pseudo_
ip str - Pseudo IP of the instance
- public_
ip str - Public IP of the instance
- ram_
mb int - RAM of the instance
- region str
- Region of the instance
- reverse_
dns str - Reverse DNS of the instance
- script str
- Script of the instance
- size str
- Size of the instance
- sshkey_
id str - SSH key id of the instance
- status str
- Status of the instance
- Sequence[str]
- Tags of the instance
- template str
- Disk image/template of the instance
- cpu
Cores Number - CPU of the instance
- created
At String - Creation date of the instance
- disk
Gb Number - SSD size of the instance
- firewall
Id String - Firewall ID of the instance
- hostname String
- Hostname of the instance
- id String
- ID of the instance
- initial
Password String - Initial password of the instance
- initial
User String - Initial user of the instance
- network
Id String - Network id of the instance
- notes String
- Note of the instance
- private
Ip String - Private IP of the instance
- pseudo
Ip String - Pseudo IP of the instance
- public
Ip String - Public IP of the instance
- ram
Mb Number - RAM of the instance
- region String
- Region of the instance
- reverse
Dns String - Reverse DNS of the instance
- script String
- Script of the instance
- size String
- Size of the instance
- sshkey
Id String - SSH key id of the instance
- status String
- Status of the instance
- List<String>
- Tags of the instance
- template String
- Disk image/template of the instance
GetInstancesSort
- Key string
- Sort instances by this key. This may be one of
cpu_cores
,created_at
,disk_gb
,firewall_id
,hostname
,id
,initial_password
,initial_user
,network_id
,notes
,private_ip
,pseudo_ip
,public_ip
,ram_mb
,region
,reverse_dns
,script
,size
,sshkey_id
,status
,template
. - Direction string
- The sort direction. This may be either
asc
ordesc
.
- Key string
- Sort instances by this key. This may be one of
cpu_cores
,created_at
,disk_gb
,firewall_id
,hostname
,id
,initial_password
,initial_user
,network_id
,notes
,private_ip
,pseudo_ip
,public_ip
,ram_mb
,region
,reverse_dns
,script
,size
,sshkey_id
,status
,template
. - Direction string
- The sort direction. This may be either
asc
ordesc
.
- key String
- Sort instances by this key. This may be one of
cpu_cores
,created_at
,disk_gb
,firewall_id
,hostname
,id
,initial_password
,initial_user
,network_id
,notes
,private_ip
,pseudo_ip
,public_ip
,ram_mb
,region
,reverse_dns
,script
,size
,sshkey_id
,status
,template
. - direction String
- The sort direction. This may be either
asc
ordesc
.
- key string
- Sort instances by this key. This may be one of
cpu_cores
,created_at
,disk_gb
,firewall_id
,hostname
,id
,initial_password
,initial_user
,network_id
,notes
,private_ip
,pseudo_ip
,public_ip
,ram_mb
,region
,reverse_dns
,script
,size
,sshkey_id
,status
,template
. - direction string
- The sort direction. This may be either
asc
ordesc
.
- key str
- Sort instances by this key. This may be one of
cpu_cores
,created_at
,disk_gb
,firewall_id
,hostname
,id
,initial_password
,initial_user
,network_id
,notes
,private_ip
,pseudo_ip
,public_ip
,ram_mb
,region
,reverse_dns
,script
,size
,sshkey_id
,status
,template
. - direction str
- The sort direction. This may be either
asc
ordesc
.
- key String
- Sort instances by this key. This may be one of
cpu_cores
,created_at
,disk_gb
,firewall_id
,hostname
,id
,initial_password
,initial_user
,network_id
,notes
,private_ip
,pseudo_ip
,public_ip
,ram_mb
,region
,reverse_dns
,script
,size
,sshkey_id
,status
,template
. - direction String
- The sort direction. This may be either
asc
ordesc
.
Package Details
- Repository
- Civo pulumi/pulumi-civo
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
civo
Terraform Provider.