1. Packages
  2. Civo Provider
  3. API Docs
  4. getInstance
Civo v2.4.6 published on Wednesday, Nov 6, 2024 by Pulumi

civo.getInstance

Explore with Pulumi AI

civo logo
Civo v2.4.6 published on Wednesday, Nov 6, 2024 by Pulumi

    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

    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);
    
    import pulumi
    import pulumi_civo as civo
    
    myhostaname = civo.get_instance(hostname="myhostname.com")
    pulumi.export("instanceOutput", myhostaname.public_ip)
    
    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
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    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 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()));
        }
    }
    
    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
    The hostname of the Instance
    Id string
    The ID of this resource.
    Region string
    The region of an existing Instance
    Hostname string
    The hostname of the Instance
    Id string
    The ID of this resource.
    Region string
    The region of an existing Instance
    hostname String
    The hostname of the Instance
    id String
    The ID of this resource.
    region String
    The region of an existing Instance
    hostname string
    The hostname of the Instance
    id string
    The ID of this resource.
    region string
    The region of an existing Instance
    hostname str
    The hostname of the Instance
    id str
    The ID of this resource.
    region str
    The region of an existing Instance
    hostname String
    The hostname of the Instance
    id String
    The ID of this resource.
    region String
    The region of an existing Instance

    getInstance Result

    The following output properties are available:

    CpuCores int
    Total cpu of the instance
    CreatedAt string
    The date of creation of the instance
    DiskGb int
    The size of the disk
    FirewallId string
    The ID of the firewall used
    InitialPassword string
    Instance initial password
    InitialUser string
    The name of the initial user created on the server
    NetworkId string
    his will be the ID of the network
    Notes string
    The notes of the instance
    PrivateIp string
    The private IP
    PseudoIp string
    Is the ip that is used to route the public ip from the internet to the instance using NAT
    PublicIp string
    The public IP
    RamMb int
    Total ram of the instance
    ReverseDns string
    A fully qualified domain name
    Script string
    The contents of a script uploaded
    Size string
    The name of the size
    SshkeyId string
    The ID SSH key
    Status string
    The status of the instance
    Tags 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
    CpuCores int
    Total cpu of the instance
    CreatedAt string
    The date of creation of the instance
    DiskGb int
    The size of the disk
    FirewallId string
    The ID of the firewall used
    InitialPassword string
    Instance initial password
    InitialUser string
    The name of the initial user created on the server
    NetworkId string
    his will be the ID of the network
    Notes string
    The notes of the instance
    PrivateIp string
    The private IP
    PseudoIp string
    Is the ip that is used to route the public ip from the internet to the instance using NAT
    PublicIp string
    The public IP
    RamMb int
    Total ram of the instance
    ReverseDns string
    A fully qualified domain name
    Script string
    The contents of a script uploaded
    Size string
    The name of the size
    SshkeyId string
    The ID SSH key
    Status string
    The status of the instance
    Tags []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
    cpuCores Integer
    Total cpu of the instance
    createdAt String
    The date of creation of the instance
    diskGb Integer
    The size of the disk
    firewallId String
    The ID of the firewall used
    initialPassword String
    Instance initial password
    initialUser String
    The name of the initial user created on the server
    networkId String
    his will be the ID of the network
    notes String
    The notes of the instance
    privateIp String
    The private IP
    pseudoIp String
    Is the ip that is used to route the public ip from the internet to the instance using NAT
    publicIp String
    The public IP
    ramMb Integer
    Total ram of the instance
    reverseDns String
    A fully qualified domain name
    script String
    The contents of a script uploaded
    size String
    The name of the size
    sshkeyId String
    The ID SSH key
    status String
    The status of the instance
    tags 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
    cpuCores number
    Total cpu of the instance
    createdAt string
    The date of creation of the instance
    diskGb number
    The size of the disk
    firewallId string
    The ID of the firewall used
    initialPassword string
    Instance initial password
    initialUser string
    The name of the initial user created on the server
    networkId string
    his will be the ID of the network
    notes string
    The notes of the instance
    privateIp string
    The private IP
    pseudoIp string
    Is the ip that is used to route the public ip from the internet to the instance using NAT
    publicIp string
    The public IP
    ramMb number
    Total ram of the instance
    reverseDns string
    A fully qualified domain name
    script string
    The contents of a script uploaded
    size string
    The name of the size
    sshkeyId string
    The ID SSH key
    status string
    The status of the instance
    tags 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 instance
    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
    tags 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
    cpuCores Number
    Total cpu of the instance
    createdAt String
    The date of creation of the instance
    diskGb Number
    The size of the disk
    firewallId String
    The ID of the firewall used
    initialPassword String
    Instance initial password
    initialUser String
    The name of the initial user created on the server
    networkId String
    his will be the ID of the network
    notes String
    The notes of the instance
    privateIp String
    The private IP
    pseudoIp String
    Is the ip that is used to route the public ip from the internet to the instance using NAT
    publicIp String
    The public IP
    ramMb Number
    Total ram of the instance
    reverseDns String
    A fully qualified domain name
    script String
    The contents of a script uploaded
    size String
    The name of the size
    sshkeyId String
    The ID SSH key
    status String
    The status of the instance
    tags 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.
    civo logo
    Civo v2.4.6 published on Wednesday, Nov 6, 2024 by Pulumi