1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. getNodeTypes
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

gcp.compute.getNodeTypes

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

    Provides available node types for Compute Engine sole-tenant nodes in a zone for a given project. For more information, see the official documentation and API.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const central1b = gcp.compute.getNodeTypes({
        zone: "us-central1-b",
    });
    const tmpl = new gcp.compute.NodeTemplate("tmpl", {
        name: "test-tmpl",
        region: "us-central1",
        nodeType: types.names[0],
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    central1b = gcp.compute.get_node_types(zone="us-central1-b")
    tmpl = gcp.compute.NodeTemplate("tmpl",
        name="test-tmpl",
        region="us-central1",
        node_type=types["names"])
    
    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.GetNodeTypes(ctx, &compute.GetNodeTypesArgs{
    			Zone: pulumi.StringRef("us-central1-b"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewNodeTemplate(ctx, "tmpl", &compute.NodeTemplateArgs{
    			Name:     pulumi.String("test-tmpl"),
    			Region:   pulumi.String("us-central1"),
    			NodeType: pulumi.Any(types.Names[0]),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var central1b = Gcp.Compute.GetNodeTypes.Invoke(new()
        {
            Zone = "us-central1-b",
        });
    
        var tmpl = new Gcp.Compute.NodeTemplate("tmpl", new()
        {
            Name = "test-tmpl",
            Region = "us-central1",
            NodeType = types.Names[0],
        });
    
    });
    
    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.GetNodeTypesArgs;
    import com.pulumi.gcp.compute.NodeTemplate;
    import com.pulumi.gcp.compute.NodeTemplateArgs;
    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 central1b = ComputeFunctions.getNodeTypes(GetNodeTypesArgs.builder()
                .zone("us-central1-b")
                .build());
    
            var tmpl = new NodeTemplate("tmpl", NodeTemplateArgs.builder()
                .name("test-tmpl")
                .region("us-central1")
                .nodeType(types.names()[0])
                .build());
    
        }
    }
    
    resources:
      tmpl:
        type: gcp:compute:NodeTemplate
        properties:
          name: test-tmpl
          region: us-central1
          nodeType: ${types.names[0]}
    variables:
      central1b:
        fn::invoke:
          Function: gcp:compute:getNodeTypes
          Arguments:
            zone: us-central1-b
    

    Using getNodeTypes

    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 getNodeTypes(args: GetNodeTypesArgs, opts?: InvokeOptions): Promise<GetNodeTypesResult>
    function getNodeTypesOutput(args: GetNodeTypesOutputArgs, opts?: InvokeOptions): Output<GetNodeTypesResult>
    def get_node_types(project: Optional[str] = None,
                       zone: Optional[str] = None,
                       opts: Optional[InvokeOptions] = None) -> GetNodeTypesResult
    def get_node_types_output(project: Optional[pulumi.Input[str]] = None,
                       zone: Optional[pulumi.Input[str]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetNodeTypesResult]
    func GetNodeTypes(ctx *Context, args *GetNodeTypesArgs, opts ...InvokeOption) (*GetNodeTypesResult, error)
    func GetNodeTypesOutput(ctx *Context, args *GetNodeTypesOutputArgs, opts ...InvokeOption) GetNodeTypesResultOutput

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

    public static class GetNodeTypes 
    {
        public static Task<GetNodeTypesResult> InvokeAsync(GetNodeTypesArgs args, InvokeOptions? opts = null)
        public static Output<GetNodeTypesResult> Invoke(GetNodeTypesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetNodeTypesResult> getNodeTypes(GetNodeTypesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: gcp:compute/getNodeTypes:getNodeTypes
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Project string
    ID of the project to list available node types for. Should match the project the nodes of this type will be deployed to. Defaults to the project that the provider is authenticated with.
    Zone string
    The zone to list node types for. Should be in zone of intended node groups and region of referencing node template. If zone is not specified, the provider-level zone must be set and is used instead.
    Project string
    ID of the project to list available node types for. Should match the project the nodes of this type will be deployed to. Defaults to the project that the provider is authenticated with.
    Zone string
    The zone to list node types for. Should be in zone of intended node groups and region of referencing node template. If zone is not specified, the provider-level zone must be set and is used instead.
    project String
    ID of the project to list available node types for. Should match the project the nodes of this type will be deployed to. Defaults to the project that the provider is authenticated with.
    zone String
    The zone to list node types for. Should be in zone of intended node groups and region of referencing node template. If zone is not specified, the provider-level zone must be set and is used instead.
    project string
    ID of the project to list available node types for. Should match the project the nodes of this type will be deployed to. Defaults to the project that the provider is authenticated with.
    zone string
    The zone to list node types for. Should be in zone of intended node groups and region of referencing node template. If zone is not specified, the provider-level zone must be set and is used instead.
    project str
    ID of the project to list available node types for. Should match the project the nodes of this type will be deployed to. Defaults to the project that the provider is authenticated with.
    zone str
    The zone to list node types for. Should be in zone of intended node groups and region of referencing node template. If zone is not specified, the provider-level zone must be set and is used instead.
    project String
    ID of the project to list available node types for. Should match the project the nodes of this type will be deployed to. Defaults to the project that the provider is authenticated with.
    zone String
    The zone to list node types for. Should be in zone of intended node groups and region of referencing node template. If zone is not specified, the provider-level zone must be set and is used instead.

    getNodeTypes Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Names List<string>
    A list of node types available in the given zone and project.
    Project string
    Zone string
    Id string
    The provider-assigned unique ID for this managed resource.
    Names []string
    A list of node types available in the given zone and project.
    Project string
    Zone string
    id String
    The provider-assigned unique ID for this managed resource.
    names List<String>
    A list of node types available in the given zone and project.
    project String
    zone String
    id string
    The provider-assigned unique ID for this managed resource.
    names string[]
    A list of node types available in the given zone and project.
    project string
    zone string
    id str
    The provider-assigned unique ID for this managed resource.
    names Sequence[str]
    A list of node types available in the given zone and project.
    project str
    zone str
    id String
    The provider-assigned unique ID for this managed resource.
    names List<String>
    A list of node types available in the given zone and project.
    project String
    zone String

    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.
    gcp logo
    Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi