1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. getInstanceGuestAttributes
Google Cloud v8.25.1 published on Wednesday, Apr 9, 2025 by Pulumi

gcp.compute.getInstanceGuestAttributes

Explore with Pulumi AI

Get information about a VM instance resource within GCE. For more information see the official documentation and API.

Get information about VM’s guest attrubutes. For more information see the official documentation and API.

Example Usage

Get All Attributes From A Single Namespace

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const appserverGa = gcp.compute.getInstanceGuestAttributes({
    name: "primary-application-server",
    zone: "us-central1-a",
    queryPath: "variables/",
});
Copy
import pulumi
import pulumi_gcp as gcp

appserver_ga = gcp.compute.get_instance_guest_attributes(name="primary-application-server",
    zone="us-central1-a",
    query_path="variables/")
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := compute.GetInstanceGuestAttributes(ctx, &compute.GetInstanceGuestAttributesArgs{
			Name:      "primary-application-server",
			Zone:      pulumi.StringRef("us-central1-a"),
			QueryPath: pulumi.StringRef("variables/"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var appserverGa = Gcp.Compute.GetInstanceGuestAttributes.Invoke(new()
    {
        Name = "primary-application-server",
        Zone = "us-central1-a",
        QueryPath = "variables/",
    });

});
Copy
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.GetInstanceGuestAttributesArgs;
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 appserverGa = ComputeFunctions.getInstanceGuestAttributes(GetInstanceGuestAttributesArgs.builder()
            .name("primary-application-server")
            .zone("us-central1-a")
            .queryPath("variables/")
            .build());

    }
}
Copy
variables:
  appserverGa:
    fn::invoke:
      function: gcp:compute:getInstanceGuestAttributes
      arguments:
        name: primary-application-server
        zone: us-central1-a
        queryPath: variables/
Copy

Get A Specific Variable

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const appserverGa = gcp.compute.getInstanceGuestAttributes({
    name: "primary-application-server",
    zone: "us-central1-a",
    variableKey: "variables/key1",
});
Copy
import pulumi
import pulumi_gcp as gcp

appserver_ga = gcp.compute.get_instance_guest_attributes(name="primary-application-server",
    zone="us-central1-a",
    variable_key="variables/key1")
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := compute.GetInstanceGuestAttributes(ctx, &compute.GetInstanceGuestAttributesArgs{
			Name:        "primary-application-server",
			Zone:        pulumi.StringRef("us-central1-a"),
			VariableKey: pulumi.StringRef("variables/key1"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var appserverGa = Gcp.Compute.GetInstanceGuestAttributes.Invoke(new()
    {
        Name = "primary-application-server",
        Zone = "us-central1-a",
        VariableKey = "variables/key1",
    });

});
Copy
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.GetInstanceGuestAttributesArgs;
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 appserverGa = ComputeFunctions.getInstanceGuestAttributes(GetInstanceGuestAttributesArgs.builder()
            .name("primary-application-server")
            .zone("us-central1-a")
            .variableKey("variables/key1")
            .build());

    }
}
Copy
variables:
  appserverGa:
    fn::invoke:
      function: gcp:compute:getInstanceGuestAttributes
      arguments:
        name: primary-application-server
        zone: us-central1-a
        variableKey: variables/key1
Copy

Using getInstanceGuestAttributes

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 getInstanceGuestAttributes(args: GetInstanceGuestAttributesArgs, opts?: InvokeOptions): Promise<GetInstanceGuestAttributesResult>
function getInstanceGuestAttributesOutput(args: GetInstanceGuestAttributesOutputArgs, opts?: InvokeOptions): Output<GetInstanceGuestAttributesResult>
Copy
def get_instance_guest_attributes(name: Optional[str] = None,
                                  project: Optional[str] = None,
                                  query_path: Optional[str] = None,
                                  region: Optional[str] = None,
                                  variable_key: Optional[str] = None,
                                  zone: Optional[str] = None,
                                  opts: Optional[InvokeOptions] = None) -> GetInstanceGuestAttributesResult
def get_instance_guest_attributes_output(name: Optional[pulumi.Input[str]] = None,
                                  project: Optional[pulumi.Input[str]] = None,
                                  query_path: Optional[pulumi.Input[str]] = None,
                                  region: Optional[pulumi.Input[str]] = None,
                                  variable_key: Optional[pulumi.Input[str]] = None,
                                  zone: Optional[pulumi.Input[str]] = None,
                                  opts: Optional[InvokeOptions] = None) -> Output[GetInstanceGuestAttributesResult]
Copy
func GetInstanceGuestAttributes(ctx *Context, args *GetInstanceGuestAttributesArgs, opts ...InvokeOption) (*GetInstanceGuestAttributesResult, error)
func GetInstanceGuestAttributesOutput(ctx *Context, args *GetInstanceGuestAttributesOutputArgs, opts ...InvokeOption) GetInstanceGuestAttributesResultOutput
Copy

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

public static class GetInstanceGuestAttributes 
{
    public static Task<GetInstanceGuestAttributesResult> InvokeAsync(GetInstanceGuestAttributesArgs args, InvokeOptions? opts = null)
    public static Output<GetInstanceGuestAttributesResult> Invoke(GetInstanceGuestAttributesInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetInstanceGuestAttributesResult> getInstanceGuestAttributes(GetInstanceGuestAttributesArgs args, InvokeOptions options)
public static Output<GetInstanceGuestAttributesResult> getInstanceGuestAttributes(GetInstanceGuestAttributesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: gcp:compute/getInstanceGuestAttributes:getInstanceGuestAttributes
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
The name or self_link of the instance.
Project string
The ID of the project in which the resource belongs. If self_link is provided, this value is ignored. If neither self_link nor project are provided, the provider project is used.
QueryPath string
Path to query for the guest attributes. Consists of namespace name for the attributes followed with a /.
Region string
VariableKey string
Key of a variable to get the value of. Consists of namespace name and key name for the variable separated by a /.
Zone string
The zone of the instance. If self_link is provided, this value is ignored. If neither self_link nor zone are provided, the provider zone is used.
Name This property is required. string
The name or self_link of the instance.
Project string
The ID of the project in which the resource belongs. If self_link is provided, this value is ignored. If neither self_link nor project are provided, the provider project is used.
QueryPath string
Path to query for the guest attributes. Consists of namespace name for the attributes followed with a /.
Region string
VariableKey string
Key of a variable to get the value of. Consists of namespace name and key name for the variable separated by a /.
Zone string
The zone of the instance. If self_link is provided, this value is ignored. If neither self_link nor zone are provided, the provider zone is used.
name This property is required. String
The name or self_link of the instance.
project String
The ID of the project in which the resource belongs. If self_link is provided, this value is ignored. If neither self_link nor project are provided, the provider project is used.
queryPath String
Path to query for the guest attributes. Consists of namespace name for the attributes followed with a /.
region String
variableKey String
Key of a variable to get the value of. Consists of namespace name and key name for the variable separated by a /.
zone String
The zone of the instance. If self_link is provided, this value is ignored. If neither self_link nor zone are provided, the provider zone is used.
name This property is required. string
The name or self_link of the instance.
project string
The ID of the project in which the resource belongs. If self_link is provided, this value is ignored. If neither self_link nor project are provided, the provider project is used.
queryPath string
Path to query for the guest attributes. Consists of namespace name for the attributes followed with a /.
region string
variableKey string
Key of a variable to get the value of. Consists of namespace name and key name for the variable separated by a /.
zone string
The zone of the instance. If self_link is provided, this value is ignored. If neither self_link nor zone are provided, the provider zone is used.
name This property is required. str
The name or self_link of the instance.
project str
The ID of the project in which the resource belongs. If self_link is provided, this value is ignored. If neither self_link nor project are provided, the provider project is used.
query_path str
Path to query for the guest attributes. Consists of namespace name for the attributes followed with a /.
region str
variable_key str
Key of a variable to get the value of. Consists of namespace name and key name for the variable separated by a /.
zone str
The zone of the instance. If self_link is provided, this value is ignored. If neither self_link nor zone are provided, the provider zone is used.
name This property is required. String
The name or self_link of the instance.
project String
The ID of the project in which the resource belongs. If self_link is provided, this value is ignored. If neither self_link nor project are provided, the provider project is used.
queryPath String
Path to query for the guest attributes. Consists of namespace name for the attributes followed with a /.
region String
variableKey String
Key of a variable to get the value of. Consists of namespace name and key name for the variable separated by a /.
zone String
The zone of the instance. If self_link is provided, this value is ignored. If neither self_link nor zone are provided, the provider zone is used.

getInstanceGuestAttributes Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Name string
Project string
QueryValues List<GetInstanceGuestAttributesQueryValue>
Structure is documented below.
Region string
VariableValue string
Value of the queried guest_attribute.
Zone string
QueryPath string
VariableKey string
Id string
The provider-assigned unique ID for this managed resource.
Name string
Project string
QueryValues []GetInstanceGuestAttributesQueryValue
Structure is documented below.
Region string
VariableValue string
Value of the queried guest_attribute.
Zone string
QueryPath string
VariableKey string
id String
The provider-assigned unique ID for this managed resource.
name String
project String
queryValues List<GetInstanceGuestAttributesQueryValue>
Structure is documented below.
region String
variableValue String
Value of the queried guest_attribute.
zone String
queryPath String
variableKey String
id string
The provider-assigned unique ID for this managed resource.
name string
project string
queryValues GetInstanceGuestAttributesQueryValue[]
Structure is documented below.
region string
variableValue string
Value of the queried guest_attribute.
zone string
queryPath string
variableKey string
id str
The provider-assigned unique ID for this managed resource.
name str
project str
query_values Sequence[GetInstanceGuestAttributesQueryValue]
Structure is documented below.
region str
variable_value str
Value of the queried guest_attribute.
zone str
query_path str
variable_key str
id String
The provider-assigned unique ID for this managed resource.
name String
project String
queryValues List<Property Map>
Structure is documented below.
region String
variableValue String
Value of the queried guest_attribute.
zone String
queryPath String
variableKey String

Supporting Types

GetInstanceGuestAttributesQueryValue

Key This property is required. string
Key of the guest_attribute.
Namespace This property is required. string
Namespace of the guest_attribute.
Value This property is required. string
Value of the guest_attribute.
Key This property is required. string
Key of the guest_attribute.
Namespace This property is required. string
Namespace of the guest_attribute.
Value This property is required. string
Value of the guest_attribute.
key This property is required. String
Key of the guest_attribute.
namespace This property is required. String
Namespace of the guest_attribute.
value This property is required. String
Value of the guest_attribute.
key This property is required. string
Key of the guest_attribute.
namespace This property is required. string
Namespace of the guest_attribute.
value This property is required. string
Value of the guest_attribute.
key This property is required. str
Key of the guest_attribute.
namespace This property is required. str
Namespace of the guest_attribute.
value This property is required. str
Value of the guest_attribute.
key This property is required. String
Key of the guest_attribute.
namespace This property is required. String
Namespace of the guest_attribute.
value This property is required. String
Value of the guest_attribute.

Package Details

Repository
Google Cloud (GCP) Classic pulumi/pulumi-gcp
License
Apache-2.0
Notes
This Pulumi package is based on the google-beta Terraform Provider.