Google Cloud (GCP) Classic

v6.39.0 published on Wednesday, Sep 28, 2022 by Pulumi

getInstanceSerialPort

Get the serial port output from a Compute Instance. For more information see the official API documentation.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var serial = Gcp.Compute.GetInstanceSerialPort.Invoke(new()
    {
        Instance = "my-instance",
        Zone = "us-central1-a",
        Port = 1,
    });

    return new Dictionary<string, object?>
    {
        ["serialOut"] = serial.Apply(getInstanceSerialPortResult => getInstanceSerialPortResult.Contents),
    };
});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/compute"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		serial, err := compute.GetInstanceSerialPort(ctx, &compute.GetInstanceSerialPortArgs{
			Instance: "my-instance",
			Zone:     pulumi.StringRef("us-central1-a"),
			Port:     1,
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("serialOut", serial.Contents)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.ComputeFunctions;
import com.pulumi.gcp.compute.inputs.GetInstanceSerialPortArgs;
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 serial = ComputeFunctions.getInstanceSerialPort(GetInstanceSerialPortArgs.builder()
            .instance("my-instance")
            .zone("us-central1-a")
            .port(1)
            .build());

        ctx.export("serialOut", serial.applyValue(getInstanceSerialPortResult -> getInstanceSerialPortResult.contents()));
    }
}
import pulumi
import pulumi_gcp as gcp

serial = gcp.compute.get_instance_serial_port(instance="my-instance",
    zone="us-central1-a",
    port=1)
pulumi.export("serialOut", serial.contents)
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const serial = gcp.compute.getInstanceSerialPort({
    instance: "my-instance",
    zone: "us-central1-a",
    port: 1,
});
export const serialOut = serial.then(serial => serial.contents);
variables:
  serial:
    Fn::Invoke:
      Function: gcp:compute:getInstanceSerialPort
      Arguments:
        instance: my-instance
        zone: us-central1-a
        port: 1
outputs:
  serialOut: ${serial.contents}

Using getInstanceSerialPort

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 getInstanceSerialPort(args: GetInstanceSerialPortArgs, opts?: InvokeOptions): Promise<GetInstanceSerialPortResult>
function getInstanceSerialPortOutput(args: GetInstanceSerialPortOutputArgs, opts?: InvokeOptions): Output<GetInstanceSerialPortResult>
def get_instance_serial_port(instance: Optional[str] = None,
                             port: Optional[int] = None,
                             project: Optional[str] = None,
                             zone: Optional[str] = None,
                             opts: Optional[InvokeOptions] = None) -> GetInstanceSerialPortResult
def get_instance_serial_port_output(instance: Optional[pulumi.Input[str]] = None,
                             port: Optional[pulumi.Input[int]] = None,
                             project: Optional[pulumi.Input[str]] = None,
                             zone: Optional[pulumi.Input[str]] = None,
                             opts: Optional[InvokeOptions] = None) -> Output[GetInstanceSerialPortResult]
func GetInstanceSerialPort(ctx *Context, args *GetInstanceSerialPortArgs, opts ...InvokeOption) (*GetInstanceSerialPortResult, error)
func GetInstanceSerialPortOutput(ctx *Context, args *GetInstanceSerialPortOutputArgs, opts ...InvokeOption) GetInstanceSerialPortResultOutput

> Note: This function is named GetInstanceSerialPort in the Go SDK.

public static class GetInstanceSerialPort 
{
    public static Task<GetInstanceSerialPortResult> InvokeAsync(GetInstanceSerialPortArgs args, InvokeOptions? opts = null)
    public static Output<GetInstanceSerialPortResult> Invoke(GetInstanceSerialPortInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetInstanceSerialPortResult> getInstanceSerialPort(GetInstanceSerialPortArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: gcp:compute/getInstanceSerialPort:getInstanceSerialPort
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Instance string

The name of the Compute Instance to read output from.

Port int

The number of the serial port to read output from. Possible values are 1-4.

Project string

The project in which the Compute Instance exists. If it is not provided, the provider project is used.

Zone string

The zone in which the Compute Instance exists. If it is not provided, the provider zone is used.

Instance string

The name of the Compute Instance to read output from.

Port int

The number of the serial port to read output from. Possible values are 1-4.

Project string

The project in which the Compute Instance exists. If it is not provided, the provider project is used.

Zone string

The zone in which the Compute Instance exists. If it is not provided, the provider zone is used.

instance String

The name of the Compute Instance to read output from.

port Integer

The number of the serial port to read output from. Possible values are 1-4.

project String

The project in which the Compute Instance exists. If it is not provided, the provider project is used.

zone String

The zone in which the Compute Instance exists. If it is not provided, the provider zone is used.

instance string

The name of the Compute Instance to read output from.

port number

The number of the serial port to read output from. Possible values are 1-4.

project string

The project in which the Compute Instance exists. If it is not provided, the provider project is used.

zone string

The zone in which the Compute Instance exists. If it is not provided, the provider zone is used.

instance str

The name of the Compute Instance to read output from.

port int

The number of the serial port to read output from. Possible values are 1-4.

project str

The project in which the Compute Instance exists. If it is not provided, the provider project is used.

zone str

The zone in which the Compute Instance exists. If it is not provided, the provider zone is used.

instance String

The name of the Compute Instance to read output from.

port Number

The number of the serial port to read output from. Possible values are 1-4.

project String

The project in which the Compute Instance exists. If it is not provided, the provider project is used.

zone String

The zone in which the Compute Instance exists. If it is not provided, the provider zone is used.

getInstanceSerialPort Result

The following output properties are available:

Contents string

The output of the serial port. Serial port output is available only when the VM instance is running, and logs are limited to the most recent 1 MB of output per port.

Id string

The provider-assigned unique ID for this managed resource.

Instance string
Port int
Project string
Zone string
Contents string

The output of the serial port. Serial port output is available only when the VM instance is running, and logs are limited to the most recent 1 MB of output per port.

Id string

The provider-assigned unique ID for this managed resource.

Instance string
Port int
Project string
Zone string
contents String

The output of the serial port. Serial port output is available only when the VM instance is running, and logs are limited to the most recent 1 MB of output per port.

id String

The provider-assigned unique ID for this managed resource.

instance String
port Integer
project String
zone String
contents string

The output of the serial port. Serial port output is available only when the VM instance is running, and logs are limited to the most recent 1 MB of output per port.

id string

The provider-assigned unique ID for this managed resource.

instance string
port number
project string
zone string
contents str

The output of the serial port. Serial port output is available only when the VM instance is running, and logs are limited to the most recent 1 MB of output per port.

id str

The provider-assigned unique ID for this managed resource.

instance str
port int
project str
zone str
contents String

The output of the serial port. Serial port output is available only when the VM instance is running, and logs are limited to the most recent 1 MB of output per port.

id String

The provider-assigned unique ID for this managed resource.

instance String
port Number
project String
zone String

Package Details

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

This Pulumi package is based on the google-beta Terraform Provider.