1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. getImage
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

tencentcloud.getImage

Explore with Pulumi AI

tencentcloud logo
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

    Provides an available image for the user.

    The Images data source fetch proper image, which could be one of the private images of the user and images of system resources provided by TencentCloud, as well as other public images and those available on the image market.

    NOTE: This data source will be deprecated, please use tencentcloud.getImages instead.

    Example Usage

    Query image

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const example = tencentcloud.getImage({});
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    example = tencentcloud.get_image()
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := tencentcloud.LookupImage(ctx, &tencentcloud.LookupImageArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Tencentcloud.GetImage.Invoke();
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.TencentcloudFunctions;
    import com.pulumi.tencentcloud.inputs.GetImageArgs;
    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 = TencentcloudFunctions.getImage();
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: tencentcloud:getImage
          arguments: {}
    

    Query image by filter

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const example = tencentcloud.getImage({
        filters: [{
            name: "image-type",
            values: ["PUBLIC_IMAGE"],
        }],
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    example = tencentcloud.get_image(filters=[{
        "name": "image-type",
        "values": ["PUBLIC_IMAGE"],
    }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := tencentcloud.LookupImage(ctx, &tencentcloud.LookupImageArgs{
    			Filters: []tencentcloud.GetImageFilter{
    				{
    					Name: "image-type",
    					Values: []string{
    						"PUBLIC_IMAGE",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Tencentcloud.GetImage.Invoke(new()
        {
            Filters = new[]
            {
                new Tencentcloud.Inputs.GetImageFilterInputArgs
                {
                    Name = "image-type",
                    Values = new[]
                    {
                        "PUBLIC_IMAGE",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.TencentcloudFunctions;
    import com.pulumi.tencentcloud.inputs.GetImageArgs;
    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 = TencentcloudFunctions.getImage(GetImageArgs.builder()
                .filters(GetImageFilterArgs.builder()
                    .name("image-type")
                    .values("PUBLIC_IMAGE")
                    .build())
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: tencentcloud:getImage
          arguments:
            filters:
              - name: image-type
                values:
                  - PUBLIC_IMAGE
    

    Query image by os name

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const example = tencentcloud.getImage({
        osName: "centos",
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    example = tencentcloud.get_image(os_name="centos")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := tencentcloud.LookupImage(ctx, &tencentcloud.LookupImageArgs{
    			OsName: pulumi.StringRef("centos"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Tencentcloud.GetImage.Invoke(new()
        {
            OsName = "centos",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.TencentcloudFunctions;
    import com.pulumi.tencentcloud.inputs.GetImageArgs;
    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 = TencentcloudFunctions.getImage(GetImageArgs.builder()
                .osName("centos")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: tencentcloud:getImage
          arguments:
            osName: centos
    

    Query image by image name regex

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const example = tencentcloud.getImage({
        imageNameRegex: "^Windows\\s.*$",
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    example = tencentcloud.get_image(image_name_regex="^Windows\\s.*$")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := tencentcloud.LookupImage(ctx, &tencentcloud.LookupImageArgs{
    			ImageNameRegex: pulumi.StringRef("^Windows\\s.*$"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Tencentcloud.GetImage.Invoke(new()
        {
            ImageNameRegex = "^Windows\\s.*$",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.TencentcloudFunctions;
    import com.pulumi.tencentcloud.inputs.GetImageArgs;
    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 = TencentcloudFunctions.getImage(GetImageArgs.builder()
                .imageNameRegex("^Windows\\s.*$")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: tencentcloud:getImage
          arguments:
            imageNameRegex: ^Windows\s.*$
    

    Using getImage

    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 getImage(args: GetImageArgs, opts?: InvokeOptions): Promise<GetImageResult>
    function getImageOutput(args: GetImageOutputArgs, opts?: InvokeOptions): Output<GetImageResult>
    def get_image(filters: Optional[Sequence[GetImageFilter]] = None,
                  id: Optional[str] = None,
                  image_name_regex: Optional[str] = None,
                  os_name: Optional[str] = None,
                  result_output_file: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetImageResult
    def get_image_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetImageFilterArgs]]]] = None,
                  id: Optional[pulumi.Input[str]] = None,
                  image_name_regex: Optional[pulumi.Input[str]] = None,
                  os_name: Optional[pulumi.Input[str]] = None,
                  result_output_file: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetImageResult]
    func LookupImage(ctx *Context, args *LookupImageArgs, opts ...InvokeOption) (*LookupImageResult, error)
    func LookupImageOutput(ctx *Context, args *LookupImageOutputArgs, opts ...InvokeOption) LookupImageResultOutput

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

    public static class GetImage 
    {
        public static Task<GetImageResult> InvokeAsync(GetImageArgs args, InvokeOptions? opts = null)
        public static Output<GetImageResult> Invoke(GetImageInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetImageResult> getImage(GetImageArgs args, InvokeOptions options)
    public static Output<GetImageResult> getImage(GetImageArgs args, InvokeOptions options)
    
    fn::invoke:
      function: tencentcloud:index/getImage:getImage
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Filters List<GetImageFilter>
    One or more name/value pairs to filter.
    Id string
    ImageNameRegex string
    A regex string to apply to the image list returned by TencentCloud. NOTE: it is not wildcard, should look like image_name_regex = "^CentOS\s+6\.8\s+64\w*".
    OsName string
    A string to apply with fuzzy match to the os_name attribute on the image list returned by TencentCloud. NOTE: when os_name is provided, highest priority is applied in this field instead of image_name_regex.
    ResultOutputFile string
    Used to save results.
    Filters []GetImageFilter
    One or more name/value pairs to filter.
    Id string
    ImageNameRegex string
    A regex string to apply to the image list returned by TencentCloud. NOTE: it is not wildcard, should look like image_name_regex = "^CentOS\s+6\.8\s+64\w*".
    OsName string
    A string to apply with fuzzy match to the os_name attribute on the image list returned by TencentCloud. NOTE: when os_name is provided, highest priority is applied in this field instead of image_name_regex.
    ResultOutputFile string
    Used to save results.
    filters List<GetImageFilter>
    One or more name/value pairs to filter.
    id String
    imageNameRegex String
    A regex string to apply to the image list returned by TencentCloud. NOTE: it is not wildcard, should look like image_name_regex = "^CentOS\s+6\.8\s+64\w*".
    osName String
    A string to apply with fuzzy match to the os_name attribute on the image list returned by TencentCloud. NOTE: when os_name is provided, highest priority is applied in this field instead of image_name_regex.
    resultOutputFile String
    Used to save results.
    filters GetImageFilter[]
    One or more name/value pairs to filter.
    id string
    imageNameRegex string
    A regex string to apply to the image list returned by TencentCloud. NOTE: it is not wildcard, should look like image_name_regex = "^CentOS\s+6\.8\s+64\w*".
    osName string
    A string to apply with fuzzy match to the os_name attribute on the image list returned by TencentCloud. NOTE: when os_name is provided, highest priority is applied in this field instead of image_name_regex.
    resultOutputFile string
    Used to save results.
    filters Sequence[GetImageFilter]
    One or more name/value pairs to filter.
    id str
    image_name_regex str
    A regex string to apply to the image list returned by TencentCloud. NOTE: it is not wildcard, should look like image_name_regex = "^CentOS\s+6\.8\s+64\w*".
    os_name str
    A string to apply with fuzzy match to the os_name attribute on the image list returned by TencentCloud. NOTE: when os_name is provided, highest priority is applied in this field instead of image_name_regex.
    result_output_file str
    Used to save results.
    filters List<Property Map>
    One or more name/value pairs to filter.
    id String
    imageNameRegex String
    A regex string to apply to the image list returned by TencentCloud. NOTE: it is not wildcard, should look like image_name_regex = "^CentOS\s+6\.8\s+64\w*".
    osName String
    A string to apply with fuzzy match to the os_name attribute on the image list returned by TencentCloud. NOTE: when os_name is provided, highest priority is applied in this field instead of image_name_regex.
    resultOutputFile String
    Used to save results.

    getImage Result

    The following output properties are available:

    Id string
    ImageId string
    An image id indicate the uniqueness of a certain image, which can be used for instance creation or resetting.
    ImageName string
    Name of this image.
    Filters List<GetImageFilter>
    ImageNameRegex string
    OsName string
    ResultOutputFile string
    Id string
    ImageId string
    An image id indicate the uniqueness of a certain image, which can be used for instance creation or resetting.
    ImageName string
    Name of this image.
    Filters []GetImageFilter
    ImageNameRegex string
    OsName string
    ResultOutputFile string
    id String
    imageId String
    An image id indicate the uniqueness of a certain image, which can be used for instance creation or resetting.
    imageName String
    Name of this image.
    filters List<GetImageFilter>
    imageNameRegex String
    osName String
    resultOutputFile String
    id string
    imageId string
    An image id indicate the uniqueness of a certain image, which can be used for instance creation or resetting.
    imageName string
    Name of this image.
    filters GetImageFilter[]
    imageNameRegex string
    osName string
    resultOutputFile string
    id str
    image_id str
    An image id indicate the uniqueness of a certain image, which can be used for instance creation or resetting.
    image_name str
    Name of this image.
    filters Sequence[GetImageFilter]
    image_name_regex str
    os_name str
    result_output_file str
    id String
    imageId String
    An image id indicate the uniqueness of a certain image, which can be used for instance creation or resetting.
    imageName String
    Name of this image.
    filters List<Property Map>
    imageNameRegex String
    osName String
    resultOutputFile String

    Supporting Types

    GetImageFilter

    Name string
    Key of the filter, valid keys: image-id, image-type, image-name.
    Values List<string>
    Values of the filter.
    Name string
    Key of the filter, valid keys: image-id, image-type, image-name.
    Values []string
    Values of the filter.
    name String
    Key of the filter, valid keys: image-id, image-type, image-name.
    values List<String>
    Values of the filter.
    name string
    Key of the filter, valid keys: image-id, image-type, image-name.
    values string[]
    Values of the filter.
    name str
    Key of the filter, valid keys: image-id, image-type, image-name.
    values Sequence[str]
    Values of the filter.
    name String
    Key of the filter, valid keys: image-id, image-type, image-name.
    values List<String>
    Values of the filter.

    Package Details

    Repository
    tencentcloud tencentcloudstack/terraform-provider-tencentcloud
    License
    Notes
    This Pulumi package is based on the tencentcloud Terraform Provider.
    tencentcloud logo
    tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack