1. Packages
  2. Hcloud Provider
  3. API Docs
  4. getServerType
Hetzner Cloud v1.21.2 published on Tuesday, Jan 28, 2025 by Pulumi

hcloud.getServerType

Explore with Pulumi AI

hcloud logo
Hetzner Cloud v1.21.2 published on Tuesday, Jan 28, 2025 by Pulumi

    Provides details about a specific Hetzner Cloud Server Type.

    Use this resource to get detailed information about specific Server Type.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as hcloud from "@pulumi/hcloud";
    
    const byId = hcloud.getServerType({
        id: 22,
    });
    const byName = hcloud.getServerType({
        name: "cx22",
    });
    const main = new hcloud.Server("main", {
        name: "my-server",
        location: "fsn1",
        image: "debian-12",
        serverType: byName.then(byName => byName.name),
    });
    
    import pulumi
    import pulumi_hcloud as hcloud
    
    by_id = hcloud.get_server_type(id=22)
    by_name = hcloud.get_server_type(name="cx22")
    main = hcloud.Server("main",
        name="my-server",
        location="fsn1",
        image="debian-12",
        server_type=by_name.name)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-hcloud/sdk/go/hcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := hcloud.GetServerType(ctx, &hcloud.GetServerTypeArgs{
    			Id: pulumi.IntRef(22),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		byName, err := hcloud.GetServerType(ctx, &hcloud.GetServerTypeArgs{
    			Name: pulumi.StringRef("cx22"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = hcloud.NewServer(ctx, "main", &hcloud.ServerArgs{
    			Name:       pulumi.String("my-server"),
    			Location:   pulumi.String("fsn1"),
    			Image:      pulumi.String("debian-12"),
    			ServerType: pulumi.String(byName.Name),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using HCloud = Pulumi.HCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var byId = HCloud.GetServerType.Invoke(new()
        {
            Id = 22,
        });
    
        var byName = HCloud.GetServerType.Invoke(new()
        {
            Name = "cx22",
        });
    
        var main = new HCloud.Server("main", new()
        {
            Name = "my-server",
            Location = "fsn1",
            Image = "debian-12",
            ServerType = byName.Apply(getServerTypeResult => getServerTypeResult.Name),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.hcloud.HcloudFunctions;
    import com.pulumi.hcloud.inputs.GetServerTypeArgs;
    import com.pulumi.hcloud.Server;
    import com.pulumi.hcloud.ServerArgs;
    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 byId = HcloudFunctions.getServerType(GetServerTypeArgs.builder()
                .id(22)
                .build());
    
            final var byName = HcloudFunctions.getServerType(GetServerTypeArgs.builder()
                .name("cx22")
                .build());
    
            var main = new Server("main", ServerArgs.builder()
                .name("my-server")
                .location("fsn1")
                .image("debian-12")
                .serverType(byName.applyValue(getServerTypeResult -> getServerTypeResult.name()))
                .build());
    
        }
    }
    
    resources:
      main:
        type: hcloud:Server
        properties:
          name: my-server
          location: fsn1
          image: debian-12
          serverType: ${byName.name}
    variables:
      byId:
        fn::invoke:
          function: hcloud:getServerType
          arguments:
            id: 22
      byName:
        fn::invoke:
          function: hcloud:getServerType
          arguments:
            name: cx22
    

    Using getServerType

    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 getServerType(args: GetServerTypeArgs, opts?: InvokeOptions): Promise<GetServerTypeResult>
    function getServerTypeOutput(args: GetServerTypeOutputArgs, opts?: InvokeOptions): Output<GetServerTypeResult>
    def get_server_type(id: Optional[int] = None,
                        name: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetServerTypeResult
    def get_server_type_output(id: Optional[pulumi.Input[int]] = None,
                        name: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetServerTypeResult]
    func GetServerType(ctx *Context, args *GetServerTypeArgs, opts ...InvokeOption) (*GetServerTypeResult, error)
    func GetServerTypeOutput(ctx *Context, args *GetServerTypeOutputArgs, opts ...InvokeOption) GetServerTypeResultOutput

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

    public static class GetServerType 
    {
        public static Task<GetServerTypeResult> InvokeAsync(GetServerTypeArgs args, InvokeOptions? opts = null)
        public static Output<GetServerTypeResult> Invoke(GetServerTypeInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetServerTypeResult> getServerType(GetServerTypeArgs args, InvokeOptions options)
    public static Output<GetServerTypeResult> getServerType(GetServerTypeArgs args, InvokeOptions options)
    
    fn::invoke:
      function: hcloud:index/getServerType:getServerType
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id int
    ID of the Server Type.
    Name string
    Name of the Server Type.
    Id int
    ID of the Server Type.
    Name string
    Name of the Server Type.
    id Integer
    ID of the Server Type.
    name String
    Name of the Server Type.
    id number
    ID of the Server Type.
    name string
    Name of the Server Type.
    id int
    ID of the Server Type.
    name str
    Name of the Server Type.
    id Number
    ID of the Server Type.
    name String
    Name of the Server Type.

    getServerType Result

    The following output properties are available:

    Architecture string
    Architecture of the cpu for a Server of this type.
    Cores double
    Number of cpu cores for a Server of this type.
    CpuType string
    Type of cpu for a Server of this type.
    DeprecationAnnounced string
    Date of the Server Type deprecation announcement.
    Description string
    Description of the Server Type.
    Disk double
    Disk size in GB for a Server of this type.
    IncludedTraffic int

    Deprecated: The field is deprecated and will always report 0 after 2024-08-05.

    IsDeprecated bool
    Whether the Server Type is deprecated.
    Memory double
    Memory in GB for a Server of this type.
    StorageType string
    Type of boot drive for a Server of this type.
    UnavailableAfter string
    Date of the Server Type removal. After this date, the Server Type cannot be used anymore.
    Id int
    ID of the Server Type.
    Name string
    Name of the Server Type.
    Architecture string
    Architecture of the cpu for a Server of this type.
    Cores float64
    Number of cpu cores for a Server of this type.
    CpuType string
    Type of cpu for a Server of this type.
    DeprecationAnnounced string
    Date of the Server Type deprecation announcement.
    Description string
    Description of the Server Type.
    Disk float64
    Disk size in GB for a Server of this type.
    IncludedTraffic int

    Deprecated: The field is deprecated and will always report 0 after 2024-08-05.

    IsDeprecated bool
    Whether the Server Type is deprecated.
    Memory float64
    Memory in GB for a Server of this type.
    StorageType string
    Type of boot drive for a Server of this type.
    UnavailableAfter string
    Date of the Server Type removal. After this date, the Server Type cannot be used anymore.
    Id int
    ID of the Server Type.
    Name string
    Name of the Server Type.
    architecture String
    Architecture of the cpu for a Server of this type.
    cores Double
    Number of cpu cores for a Server of this type.
    cpuType String
    Type of cpu for a Server of this type.
    deprecationAnnounced String
    Date of the Server Type deprecation announcement.
    description String
    Description of the Server Type.
    disk Double
    Disk size in GB for a Server of this type.
    includedTraffic Integer

    Deprecated: The field is deprecated and will always report 0 after 2024-08-05.

    isDeprecated Boolean
    Whether the Server Type is deprecated.
    memory Double
    Memory in GB for a Server of this type.
    storageType String
    Type of boot drive for a Server of this type.
    unavailableAfter String
    Date of the Server Type removal. After this date, the Server Type cannot be used anymore.
    id Integer
    ID of the Server Type.
    name String
    Name of the Server Type.
    architecture string
    Architecture of the cpu for a Server of this type.
    cores number
    Number of cpu cores for a Server of this type.
    cpuType string
    Type of cpu for a Server of this type.
    deprecationAnnounced string
    Date of the Server Type deprecation announcement.
    description string
    Description of the Server Type.
    disk number
    Disk size in GB for a Server of this type.
    includedTraffic number

    Deprecated: The field is deprecated and will always report 0 after 2024-08-05.

    isDeprecated boolean
    Whether the Server Type is deprecated.
    memory number
    Memory in GB for a Server of this type.
    storageType string
    Type of boot drive for a Server of this type.
    unavailableAfter string
    Date of the Server Type removal. After this date, the Server Type cannot be used anymore.
    id number
    ID of the Server Type.
    name string
    Name of the Server Type.
    architecture str
    Architecture of the cpu for a Server of this type.
    cores float
    Number of cpu cores for a Server of this type.
    cpu_type str
    Type of cpu for a Server of this type.
    deprecation_announced str
    Date of the Server Type deprecation announcement.
    description str
    Description of the Server Type.
    disk float
    Disk size in GB for a Server of this type.
    included_traffic int

    Deprecated: The field is deprecated and will always report 0 after 2024-08-05.

    is_deprecated bool
    Whether the Server Type is deprecated.
    memory float
    Memory in GB for a Server of this type.
    storage_type str
    Type of boot drive for a Server of this type.
    unavailable_after str
    Date of the Server Type removal. After this date, the Server Type cannot be used anymore.
    id int
    ID of the Server Type.
    name str
    Name of the Server Type.
    architecture String
    Architecture of the cpu for a Server of this type.
    cores Number
    Number of cpu cores for a Server of this type.
    cpuType String
    Type of cpu for a Server of this type.
    deprecationAnnounced String
    Date of the Server Type deprecation announcement.
    description String
    Description of the Server Type.
    disk Number
    Disk size in GB for a Server of this type.
    includedTraffic Number

    Deprecated: The field is deprecated and will always report 0 after 2024-08-05.

    isDeprecated Boolean
    Whether the Server Type is deprecated.
    memory Number
    Memory in GB for a Server of this type.
    storageType String
    Type of boot drive for a Server of this type.
    unavailableAfter String
    Date of the Server Type removal. After this date, the Server Type cannot be used anymore.
    id Number
    ID of the Server Type.
    name String
    Name of the Server Type.

    Package Details

    Repository
    Hetzner Cloud pulumi/pulumi-hcloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the hcloud Terraform Provider.
    hcloud logo
    Hetzner Cloud v1.21.2 published on Tuesday, Jan 28, 2025 by Pulumi