civo.getInstance
Get information on an instance for use in other resources. This data source provides all of the instance’s properties as configured on your Civo account.
Note: This data source returns a single instance. When specifying a hostname, an error will be raised if more than one instances found.
Example Usage
using System.Collections.Generic;
using Pulumi;
using Civo = Pulumi.Civo;
return await Deployment.RunAsync(() =>
{
var myhostaname = Civo.GetInstance.Invoke(new()
{
Hostname = "myhostname.com",
});
return new Dictionary<string, object?>
{
["instanceOutput"] = myhostaname.Apply(getInstanceResult => getInstanceResult.PublicIp),
};
});
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 {
myhostaname, err := civo.LookupInstance(ctx, &civo.LookupInstanceArgs{
Hostname: pulumi.StringRef("myhostname.com"),
}, nil)
if err != nil {
return err
}
ctx.Export("instanceOutput", myhostaname.PublicIp)
return nil
})
}
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.GetInstanceArgs;
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 myhostaname = CivoFunctions.getInstance(GetInstanceArgs.builder()
.hostname("myhostname.com")
.build());
ctx.export("instanceOutput", myhostaname.applyValue(getInstanceResult -> getInstanceResult.publicIp()));
}
}
import pulumi
import pulumi_civo as civo
myhostaname = civo.get_instance(hostname="myhostname.com")
pulumi.export("instanceOutput", myhostaname.public_ip)
import * as pulumi from "@pulumi/pulumi";
import * as civo from "@pulumi/civo";
const myhostaname = civo.getInstance({
hostname: "myhostname.com",
});
export const instanceOutput = myhostaname.then(myhostaname => myhostaname.publicIp);
variables:
myhostaname:
fn::invoke:
Function: civo:getInstance
Arguments:
hostname: myhostname.com
outputs:
instanceOutput: ${myhostaname.publicIp}
Using getInstance
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 getInstance(args: GetInstanceArgs, opts?: InvokeOptions): Promise<GetInstanceResult>
function getInstanceOutput(args: GetInstanceOutputArgs, opts?: InvokeOptions): Output<GetInstanceResult>
def get_instance(hostname: Optional[str] = None,
id: Optional[str] = None,
region: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetInstanceResult
def get_instance_output(hostname: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
region: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetInstanceResult]
func LookupInstance(ctx *Context, args *LookupInstanceArgs, opts ...InvokeOption) (*LookupInstanceResult, error)
func LookupInstanceOutput(ctx *Context, args *LookupInstanceOutputArgs, opts ...InvokeOption) LookupInstanceResultOutput
> Note: This function is named LookupInstance
in the Go SDK.
public static class GetInstance
{
public static Task<GetInstanceResult> InvokeAsync(GetInstanceArgs args, InvokeOptions? opts = null)
public static Output<GetInstanceResult> Invoke(GetInstanceInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetInstanceResult> getInstance(GetInstanceArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: civo:index/getInstance:getInstance
arguments:
# arguments dictionary
The following arguments are supported:
getInstance Result
The following output properties are available:
- Cpu
Cores int Total cpu of the inatance
- Created
At string The date of creation of the instance
- Disk
Gb int The size of the disk
- Firewall
Id string The ID of the firewall used
- Initial
Password string Instance initial password
- Initial
User string The name of the initial user created on the server
- Network
Id string his will be the ID of the network
- Notes string
The notes of the instance
- Private
Ip string The private IP
- Pseudo
Ip string Is the ip that is used to route the public ip from the internet to the instance using NAT
- Public
Ip string The public IP
- Ram
Mb int Total ram of the instance
- Reverse
Dns string A fully qualified domain name
- Script string
The contents of a script uploaded
- Size string
The name of the size
- Sshkey
Id string The ID SSH key
- Status string
The status of the instance
- List<string>
An optional list of tags
- Template string
The ID for the disk image/template to used to build the instance
- Hostname string
The hostname of the Instance
- Id string
The ID of this resource.
- Region string
The region of an existing Instance
- Cpu
Cores int Total cpu of the inatance
- Created
At string The date of creation of the instance
- Disk
Gb int The size of the disk
- Firewall
Id string The ID of the firewall used
- Initial
Password string Instance initial password
- Initial
User string The name of the initial user created on the server
- Network
Id string his will be the ID of the network
- Notes string
The notes of the instance
- Private
Ip string The private IP
- Pseudo
Ip string Is the ip that is used to route the public ip from the internet to the instance using NAT
- Public
Ip string The public IP
- Ram
Mb int Total ram of the instance
- Reverse
Dns string A fully qualified domain name
- Script string
The contents of a script uploaded
- Size string
The name of the size
- Sshkey
Id string The ID SSH key
- Status string
The status of the instance
- []string
An optional list of tags
- Template string
The ID for the disk image/template to used to build the instance
- Hostname string
The hostname of the Instance
- Id string
The ID of this resource.
- Region string
The region of an existing Instance
- cpu
Cores Integer Total cpu of the inatance
- created
At String The date of creation of the instance
- disk
Gb Integer The size of the disk
- firewall
Id String The ID of the firewall used
- initial
Password String Instance initial password
- initial
User String The name of the initial user created on the server
- network
Id String his will be the ID of the network
- notes String
The notes of the instance
- private
Ip String The private IP
- pseudo
Ip String Is the ip that is used to route the public ip from the internet to the instance using NAT
- public
Ip String The public IP
- ram
Mb Integer Total ram of the instance
- reverse
Dns String A fully qualified domain name
- script String
The contents of a script uploaded
- size String
The name of the size
- sshkey
Id String The ID SSH key
- status String
The status of the instance
- List<String>
An optional list of tags
- template String
The ID for the disk image/template to used to build the instance
- hostname String
The hostname of the Instance
- id String
The ID of this resource.
- region String
The region of an existing Instance
- cpu
Cores number Total cpu of the inatance
- created
At string The date of creation of the instance
- disk
Gb number The size of the disk
- firewall
Id string The ID of the firewall used
- initial
Password string Instance initial password
- initial
User string The name of the initial user created on the server
- network
Id string his will be the ID of the network
- notes string
The notes of the instance
- private
Ip string The private IP
- pseudo
Ip string Is the ip that is used to route the public ip from the internet to the instance using NAT
- public
Ip string The public IP
- ram
Mb number Total ram of the instance
- reverse
Dns string A fully qualified domain name
- script string
The contents of a script uploaded
- size string
The name of the size
- sshkey
Id string The ID SSH key
- status string
The status of the instance
- string[]
An optional list of tags
- template string
The ID for the disk image/template to used to build the instance
- hostname string
The hostname of the Instance
- id string
The ID of this resource.
- region string
The region of an existing Instance
- cpu_
cores int Total cpu of the inatance
- created_
at str The date of creation of the instance
- disk_
gb int The size of the disk
- firewall_
id str The ID of the firewall used
- initial_
password str Instance initial password
- initial_
user str The name of the initial user created on the server
- network_
id str his will be the ID of the network
- notes str
The notes of the instance
- private_
ip str The private IP
- pseudo_
ip str Is the ip that is used to route the public ip from the internet to the instance using NAT
- public_
ip str The public IP
- ram_
mb int Total ram of the instance
- reverse_
dns str A fully qualified domain name
- script str
The contents of a script uploaded
- size str
The name of the size
- sshkey_
id str The ID SSH key
- status str
The status of the instance
- Sequence[str]
An optional list of tags
- template str
The ID for the disk image/template to used to build the instance
- hostname str
The hostname of the Instance
- id str
The ID of this resource.
- region str
The region of an existing Instance
- cpu
Cores Number Total cpu of the inatance
- created
At String The date of creation of the instance
- disk
Gb Number The size of the disk
- firewall
Id String The ID of the firewall used
- initial
Password String Instance initial password
- initial
User String The name of the initial user created on the server
- network
Id String his will be the ID of the network
- notes String
The notes of the instance
- private
Ip String The private IP
- pseudo
Ip String Is the ip that is used to route the public ip from the internet to the instance using NAT
- public
Ip String The public IP
- ram
Mb Number Total ram of the instance
- reverse
Dns String A fully qualified domain name
- script String
The contents of a script uploaded
- size String
The name of the size
- sshkey
Id String The ID SSH key
- status String
The status of the instance
- List<String>
An optional list of tags
- template String
The ID for the disk image/template to used to build the instance
- hostname String
The hostname of the Instance
- id String
The ID of this resource.
- region String
The region of an existing Instance
Package Details
- Repository
- Civo pulumi/pulumi-civo
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
civo
Terraform Provider.