Civo

Pulumi Official
Package maintained by Pulumi
v2.2.4 published on Friday, Jul 29, 2022 by Pulumi

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 Pulumi;
using Civo = Pulumi.Civo;

class MyStack : Stack
{
    public MyStack()
    {
        var myhostaname = Output.Create(Civo.GetInstance.InvokeAsync(new Civo.GetInstanceArgs
        {
            Hostname = "myhostname.com",
        }));
        this.InstanceOutput = myhostaname.Apply(myhostaname => myhostaname.PublicIp);
    }

    [Output("instanceOutput")]
    public Output<string> InstanceOutput { get; set; }
}
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, &GetInstanceArgs{
			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:

Hostname string
Id string
Region string
Hostname string
Id string
Region string
hostname String
id String
region String
hostname string
id string
region string
hostname str
id str
region str
hostname String
id String
region String

getInstance Result

The following output properties are available:

CpuCores int
CreatedAt string
DiskGb int
FirewallId string
InitialPassword string
InitialUser string
NetworkId string
Notes string
PrivateIp string
PseudoIp string
PublicIp string
RamMb int
ReverseDns string
Script string
Size string
SshkeyId string
Status string
Tags List<string>
Template string
Hostname string
Id string
Region string
CpuCores int
CreatedAt string
DiskGb int
FirewallId string
InitialPassword string
InitialUser string
NetworkId string
Notes string
PrivateIp string
PseudoIp string
PublicIp string
RamMb int
ReverseDns string
Script string
Size string
SshkeyId string
Status string
Tags []string
Template string
Hostname string
Id string
Region string
cpuCores Integer
createdAt String
diskGb Integer
firewallId String
initialPassword String
initialUser String
networkId String
notes String
privateIp String
pseudoIp String
publicIp String
ramMb Integer
reverseDns String
script String
size String
sshkeyId String
status String
tags List<String>
template String
hostname String
id String
region String
cpuCores number
createdAt string
diskGb number
firewallId string
initialPassword string
initialUser string
networkId string
notes string
privateIp string
pseudoIp string
publicIp string
ramMb number
reverseDns string
script string
size string
sshkeyId string
status string
tags string[]
template string
hostname string
id string
region string
cpuCores Number
createdAt String
diskGb Number
firewallId String
initialPassword String
initialUser String
networkId String
notes String
privateIp String
pseudoIp String
publicIp String
ramMb Number
reverseDns String
script String
size String
sshkeyId String
status String
tags List<String>
template String
hostname String
id String
region String

Package Details

Repository
https://github.com/pulumi/pulumi-civo
License
Apache-2.0
Notes

This Pulumi package is based on the civo Terraform Provider.