1. Packages
  2. Ucloud Provider
  3. API Docs
  4. getBaremetalImages
ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud

ucloud.getBaremetalImages

Explore with Pulumi AI

ucloud logo
ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud

    The ucloud.getBaremetalImages data source provides a list of bare metal images available in UCloud. The images can be filtered by their properties.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ucloud from "@pulumi/ucloud";
    
    const example = ucloud.getBaremetalImages({
        availabilityZone: "cn-bj2-02",
        imageType: "base",
        osType: "CentOS",
        instanceType: "xyz-type",
    });
    export const imageId = example.then(example => example.images?.[0]?.id);
    
    import pulumi
    import pulumi_ucloud as ucloud
    
    example = ucloud.get_baremetal_images(availability_zone="cn-bj2-02",
        image_type="base",
        os_type="CentOS",
        instance_type="xyz-type")
    pulumi.export("imageId", example.images[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ucloud/ucloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := ucloud.GetBaremetalImages(ctx, &ucloud.GetBaremetalImagesArgs{
    			AvailabilityZone: pulumi.StringRef("cn-bj2-02"),
    			ImageType:        pulumi.StringRef("base"),
    			OsType:           pulumi.StringRef("CentOS"),
    			InstanceType:     pulumi.StringRef("xyz-type"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("imageId", example.Images[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ucloud = Pulumi.Ucloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ucloud.GetBaremetalImages.Invoke(new()
        {
            AvailabilityZone = "cn-bj2-02",
            ImageType = "base",
            OsType = "CentOS",
            InstanceType = "xyz-type",
        });
    
        return new Dictionary<string, object?>
        {
            ["imageId"] = example.Apply(getBaremetalImagesResult => getBaremetalImagesResult.Images[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ucloud.UcloudFunctions;
    import com.pulumi.ucloud.inputs.GetBaremetalImagesArgs;
    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 example = UcloudFunctions.getBaremetalImages(GetBaremetalImagesArgs.builder()
                .availabilityZone("cn-bj2-02")
                .imageType("base")
                .osType("CentOS")
                .instanceType("xyz-type")
                .build());
    
            ctx.export("imageId", example.applyValue(getBaremetalImagesResult -> getBaremetalImagesResult.images()[0].id()));
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ucloud:getBaremetalImages
          arguments:
            availabilityZone: cn-bj2-02
            imageType: base
            osType: CentOS
            instanceType: xyz-type
    outputs:
      imageId: ${example.images[0].id}
    

    Using getBaremetalImages

    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 getBaremetalImages(args: GetBaremetalImagesArgs, opts?: InvokeOptions): Promise<GetBaremetalImagesResult>
    function getBaremetalImagesOutput(args: GetBaremetalImagesOutputArgs, opts?: InvokeOptions): Output<GetBaremetalImagesResult>
    def get_baremetal_images(availability_zone: Optional[str] = None,
                             id: Optional[str] = None,
                             ids: Optional[Sequence[str]] = None,
                             image_id: Optional[str] = None,
                             image_type: Optional[str] = None,
                             instance_type: Optional[str] = None,
                             name_regex: Optional[str] = None,
                             os_type: Optional[str] = None,
                             output_file: Optional[str] = None,
                             opts: Optional[InvokeOptions] = None) -> GetBaremetalImagesResult
    def get_baremetal_images_output(availability_zone: Optional[pulumi.Input[str]] = None,
                             id: Optional[pulumi.Input[str]] = None,
                             ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                             image_id: Optional[pulumi.Input[str]] = None,
                             image_type: Optional[pulumi.Input[str]] = None,
                             instance_type: Optional[pulumi.Input[str]] = None,
                             name_regex: Optional[pulumi.Input[str]] = None,
                             os_type: Optional[pulumi.Input[str]] = None,
                             output_file: Optional[pulumi.Input[str]] = None,
                             opts: Optional[InvokeOptions] = None) -> Output[GetBaremetalImagesResult]
    func GetBaremetalImages(ctx *Context, args *GetBaremetalImagesArgs, opts ...InvokeOption) (*GetBaremetalImagesResult, error)
    func GetBaremetalImagesOutput(ctx *Context, args *GetBaremetalImagesOutputArgs, opts ...InvokeOption) GetBaremetalImagesResultOutput

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

    public static class GetBaremetalImages 
    {
        public static Task<GetBaremetalImagesResult> InvokeAsync(GetBaremetalImagesArgs args, InvokeOptions? opts = null)
        public static Output<GetBaremetalImagesResult> Invoke(GetBaremetalImagesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetBaremetalImagesResult> getBaremetalImages(GetBaremetalImagesArgs args, InvokeOptions options)
    public static Output<GetBaremetalImagesResult> getBaremetalImages(GetBaremetalImagesArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ucloud:index/getBaremetalImages:getBaremetalImages
      arguments:
        # arguments dictionary

    The following arguments are supported:

    AvailabilityZone string
    The availability zone where the images are located.
    Id string
    The ID of the image.
    Ids List<string>
    A list of image IDs, all the images belong to this region will be retrieved if the ID is [].
    ImageId string
    ImageType string
    The type of image. Possible values are base for standard images and custom for custom images.
    InstanceType string
    Machine type of the bare metal instance where the images can be installed.
    NameRegex string
    A regex string to filter resulting images by name. (Such as: ^CentOS 7.[1-2] 64 means CentOS 7.1 of 64-bit operating system or CentOS 7.2 of 64-bit operating system, "^Ubuntu 16.04 64" means Ubuntu 16.04 of 64-bit operating system).
    OsType string
    The type of OS. Possible values are CentOS, Ubuntu, and Windows.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    AvailabilityZone string
    The availability zone where the images are located.
    Id string
    The ID of the image.
    Ids []string
    A list of image IDs, all the images belong to this region will be retrieved if the ID is [].
    ImageId string
    ImageType string
    The type of image. Possible values are base for standard images and custom for custom images.
    InstanceType string
    Machine type of the bare metal instance where the images can be installed.
    NameRegex string
    A regex string to filter resulting images by name. (Such as: ^CentOS 7.[1-2] 64 means CentOS 7.1 of 64-bit operating system or CentOS 7.2 of 64-bit operating system, "^Ubuntu 16.04 64" means Ubuntu 16.04 of 64-bit operating system).
    OsType string
    The type of OS. Possible values are CentOS, Ubuntu, and Windows.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    availabilityZone String
    The availability zone where the images are located.
    id String
    The ID of the image.
    ids List<String>
    A list of image IDs, all the images belong to this region will be retrieved if the ID is [].
    imageId String
    imageType String
    The type of image. Possible values are base for standard images and custom for custom images.
    instanceType String
    Machine type of the bare metal instance where the images can be installed.
    nameRegex String
    A regex string to filter resulting images by name. (Such as: ^CentOS 7.[1-2] 64 means CentOS 7.1 of 64-bit operating system or CentOS 7.2 of 64-bit operating system, "^Ubuntu 16.04 64" means Ubuntu 16.04 of 64-bit operating system).
    osType String
    The type of OS. Possible values are CentOS, Ubuntu, and Windows.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    availabilityZone string
    The availability zone where the images are located.
    id string
    The ID of the image.
    ids string[]
    A list of image IDs, all the images belong to this region will be retrieved if the ID is [].
    imageId string
    imageType string
    The type of image. Possible values are base for standard images and custom for custom images.
    instanceType string
    Machine type of the bare metal instance where the images can be installed.
    nameRegex string
    A regex string to filter resulting images by name. (Such as: ^CentOS 7.[1-2] 64 means CentOS 7.1 of 64-bit operating system or CentOS 7.2 of 64-bit operating system, "^Ubuntu 16.04 64" means Ubuntu 16.04 of 64-bit operating system).
    osType string
    The type of OS. Possible values are CentOS, Ubuntu, and Windows.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    availability_zone str
    The availability zone where the images are located.
    id str
    The ID of the image.
    ids Sequence[str]
    A list of image IDs, all the images belong to this region will be retrieved if the ID is [].
    image_id str
    image_type str
    The type of image. Possible values are base for standard images and custom for custom images.
    instance_type str
    Machine type of the bare metal instance where the images can be installed.
    name_regex str
    A regex string to filter resulting images by name. (Such as: ^CentOS 7.[1-2] 64 means CentOS 7.1 of 64-bit operating system or CentOS 7.2 of 64-bit operating system, "^Ubuntu 16.04 64" means Ubuntu 16.04 of 64-bit operating system).
    os_type str
    The type of OS. Possible values are CentOS, Ubuntu, and Windows.
    output_file str
    File name where to save data source results (after running pulumi preview).
    availabilityZone String
    The availability zone where the images are located.
    id String
    The ID of the image.
    ids List<String>
    A list of image IDs, all the images belong to this region will be retrieved if the ID is [].
    imageId String
    imageType String
    The type of image. Possible values are base for standard images and custom for custom images.
    instanceType String
    Machine type of the bare metal instance where the images can be installed.
    nameRegex String
    A regex string to filter resulting images by name. (Such as: ^CentOS 7.[1-2] 64 means CentOS 7.1 of 64-bit operating system or CentOS 7.2 of 64-bit operating system, "^Ubuntu 16.04 64" means Ubuntu 16.04 of 64-bit operating system).
    osType String
    The type of OS. Possible values are CentOS, Ubuntu, and Windows.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    getBaremetalImages Result

    The following output properties are available:

    Id string
    The ID of the image.
    Ids List<string>
    Images List<GetBaremetalImagesImage>
    A list of images that match the given criteria. Each image has the following attributes:
    TotalCount double
    The total number of images that satisfy the given criteria.
    AvailabilityZone string
    The availability zone where the image is located.
    ImageId string
    ImageType string
    InstanceType string
    NameRegex string
    OsType string
    The type of the OS.
    OutputFile string
    Id string
    The ID of the image.
    Ids []string
    Images []GetBaremetalImagesImage
    A list of images that match the given criteria. Each image has the following attributes:
    TotalCount float64
    The total number of images that satisfy the given criteria.
    AvailabilityZone string
    The availability zone where the image is located.
    ImageId string
    ImageType string
    InstanceType string
    NameRegex string
    OsType string
    The type of the OS.
    OutputFile string
    id String
    The ID of the image.
    ids List<String>
    images List<GetBaremetalImagesImage>
    A list of images that match the given criteria. Each image has the following attributes:
    totalCount Double
    The total number of images that satisfy the given criteria.
    availabilityZone String
    The availability zone where the image is located.
    imageId String
    imageType String
    instanceType String
    nameRegex String
    osType String
    The type of the OS.
    outputFile String
    id string
    The ID of the image.
    ids string[]
    images GetBaremetalImagesImage[]
    A list of images that match the given criteria. Each image has the following attributes:
    totalCount number
    The total number of images that satisfy the given criteria.
    availabilityZone string
    The availability zone where the image is located.
    imageId string
    imageType string
    instanceType string
    nameRegex string
    osType string
    The type of the OS.
    outputFile string
    id str
    The ID of the image.
    ids Sequence[str]
    images Sequence[GetBaremetalImagesImage]
    A list of images that match the given criteria. Each image has the following attributes:
    total_count float
    The total number of images that satisfy the given criteria.
    availability_zone str
    The availability zone where the image is located.
    image_id str
    image_type str
    instance_type str
    name_regex str
    os_type str
    The type of the OS.
    output_file str
    id String
    The ID of the image.
    ids List<String>
    images List<Property Map>
    A list of images that match the given criteria. Each image has the following attributes:
    totalCount Number
    The total number of images that satisfy the given criteria.
    availabilityZone String
    The availability zone where the image is located.
    imageId String
    imageType String
    instanceType String
    nameRegex String
    osType String
    The type of the OS.
    outputFile String

    Supporting Types

    GetBaremetalImagesImage

    AvailabilityZone string
    The availability zone where the images are located.
    Description string
    The description of the image, if any.
    Id string
    The ID of the image.
    Name string
    The name of the image.
    OsName string
    The name of the OS.
    OsType string
    The type of OS. Possible values are CentOS, Ubuntu, and Windows.
    Size double
    Status string
    The status of image. Possible values are Available, Making and Unavailable.
    Type string
    The type of the image.
    AvailabilityZone string
    The availability zone where the images are located.
    Description string
    The description of the image, if any.
    Id string
    The ID of the image.
    Name string
    The name of the image.
    OsName string
    The name of the OS.
    OsType string
    The type of OS. Possible values are CentOS, Ubuntu, and Windows.
    Size float64
    Status string
    The status of image. Possible values are Available, Making and Unavailable.
    Type string
    The type of the image.
    availabilityZone String
    The availability zone where the images are located.
    description String
    The description of the image, if any.
    id String
    The ID of the image.
    name String
    The name of the image.
    osName String
    The name of the OS.
    osType String
    The type of OS. Possible values are CentOS, Ubuntu, and Windows.
    size Double
    status String
    The status of image. Possible values are Available, Making and Unavailable.
    type String
    The type of the image.
    availabilityZone string
    The availability zone where the images are located.
    description string
    The description of the image, if any.
    id string
    The ID of the image.
    name string
    The name of the image.
    osName string
    The name of the OS.
    osType string
    The type of OS. Possible values are CentOS, Ubuntu, and Windows.
    size number
    status string
    The status of image. Possible values are Available, Making and Unavailable.
    type string
    The type of the image.
    availability_zone str
    The availability zone where the images are located.
    description str
    The description of the image, if any.
    id str
    The ID of the image.
    name str
    The name of the image.
    os_name str
    The name of the OS.
    os_type str
    The type of OS. Possible values are CentOS, Ubuntu, and Windows.
    size float
    status str
    The status of image. Possible values are Available, Making and Unavailable.
    type str
    The type of the image.
    availabilityZone String
    The availability zone where the images are located.
    description String
    The description of the image, if any.
    id String
    The ID of the image.
    name String
    The name of the image.
    osName String
    The name of the OS.
    osType String
    The type of OS. Possible values are CentOS, Ubuntu, and Windows.
    size Number
    status String
    The status of image. Possible values are Available, Making and Unavailable.
    type String
    The type of the image.

    Package Details

    Repository
    ucloud ucloud/terraform-provider-ucloud
    License
    Notes
    This Pulumi package is based on the ucloud Terraform Provider.
    ucloud logo
    ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud