1. Packages
  2. Packages
  3. Alibaba Cloud Provider
  4. API Docs
  5. esa
  6. getCacheReserveInstances
Viewing docs for Alibaba Cloud v3.105.0
published on Thursday, Jul 16, 2026 by Pulumi
alicloud logo
Viewing docs for Alibaba Cloud v3.105.0
published on Thursday, Jul 16, 2026 by Pulumi

    This data source provides the Esa Cache Reserve Instances of the current Alibaba Cloud user.

    NOTE: Available since v1.282.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const _default = new alicloud.esa.CacheReserveInstance("default", {
        quotaGb: 10240,
        crRegion: "CN-beijing",
        period: 1,
        paymentType: "Subscription",
        autoPay: true,
    });
    const ids = alicloud.esa.getCacheReserveInstancesOutput({
        ids: [_default.id],
    });
    export const esaCacheReserveInstancesId0 = ids.apply(ids => ids.instances?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    default = alicloud.esa.CacheReserveInstance("default",
        quota_gb=10240,
        cr_region="CN-beijing",
        period=1,
        payment_type="Subscription",
        auto_pay=True)
    ids = alicloud.esa.get_cache_reserve_instances_output(ids=[default.id])
    pulumi.export("esaCacheReserveInstancesId0", ids.instances[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/esa"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_default, err := esa.NewCacheReserveInstance(ctx, "default", &esa.CacheReserveInstanceArgs{
    			QuotaGb:     pulumi.Int(10240),
    			CrRegion:    pulumi.String("CN-beijing"),
    			Period:      pulumi.Int(1),
    			PaymentType: pulumi.String("Subscription"),
    			AutoPay:     pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		ids := esa.GetCacheReserveInstancesOutput(ctx, esa.GetCacheReserveInstancesOutputArgs{
    			Ids: pulumi.StringArray{
    				_default.ID(),
    			},
    		}, nil)
    		ctx.Export("esaCacheReserveInstancesId0", ids.ApplyT(func(ids esa.GetCacheReserveInstancesResult) (*string, error) {
    			return ids.Instances[0].Id, nil
    		}).(pulumi.StringPtrOutput))
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var @default = new AliCloud.Esa.CacheReserveInstance("default", new()
        {
            QuotaGb = 10240,
            CrRegion = "CN-beijing",
            Period = 1,
            PaymentType = "Subscription",
            AutoPay = true,
        });
    
        var ids = AliCloud.Esa.GetCacheReserveInstances.Invoke(new()
        {
            Ids = new[]
            {
                @default.Id,
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["esaCacheReserveInstancesId0"] = ids.Apply(getCacheReserveInstancesResult => getCacheReserveInstancesResult.Instances[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.esa.CacheReserveInstance;
    import com.pulumi.alicloud.esa.CacheReserveInstanceArgs;
    import com.pulumi.alicloud.esa.EsaFunctions;
    import com.pulumi.alicloud.esa.inputs.GetCacheReserveInstancesArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            var default_ = new CacheReserveInstance("default", CacheReserveInstanceArgs.builder()
                .quotaGb(10240)
                .crRegion("CN-beijing")
                .period(1)
                .paymentType("Subscription")
                .autoPay(true)
                .build());
    
            final var ids = EsaFunctions.getCacheReserveInstances(GetCacheReserveInstancesArgs.builder()
                .ids(default_.id())
                .build());
    
            ctx.export("esaCacheReserveInstancesId0", ids.applyValue(_ids -> _ids.instances()[0].id()));
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    resources:
      default:
        type: alicloud:esa:CacheReserveInstance
        properties:
          quotaGb: '10240'
          crRegion: CN-beijing
          period: '1'
          paymentType: Subscription
          autoPay: true
    variables:
      ids:
        fn::invoke:
          function: alicloud:esa:getCacheReserveInstances
          arguments:
            ids:
              - ${default.id}
    outputs:
      esaCacheReserveInstancesId0: ${ids.instances[0].id}
    
    pulumi {
      required_providers {
        alicloud = {
          source = "pulumi/alicloud"
        }
      }
    }
    
    data "alicloud_esa_getcachereserveinstances" "ids" {
      ids = [alicloud_esa_cachereserveinstance.default.id]
    }
    
    resource "alicloud_esa_cachereserveinstance" "default" {
      quota_gb     = "10240"
      cr_region    = "CN-beijing"
      period       = "1"
      payment_type = "Subscription"
      auto_pay     = true
    }
    variable "name" {
      type    = string
      default = "terraform-example"
    }
    output "esaCacheReserveInstancesId0" {
      value = data.alicloud_esa_getcachereserveinstances.ids.instances[0].id
    }
    

    Using getCacheReserveInstances

    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 getCacheReserveInstances(args: GetCacheReserveInstancesArgs, opts?: InvokeOptions): Promise<GetCacheReserveInstancesResult>
    function getCacheReserveInstancesOutput(args: GetCacheReserveInstancesOutputArgs, opts?: InvokeOptions): Output<GetCacheReserveInstancesResult>
    def get_cache_reserve_instances(cache_reserve_instance_id: Optional[str] = None,
                                    ids: Optional[Sequence[str]] = None,
                                    output_file: Optional[str] = None,
                                    sort_by: Optional[str] = None,
                                    sort_order: Optional[str] = None,
                                    status: Optional[str] = None,
                                    opts: Optional[InvokeOptions] = None) -> GetCacheReserveInstancesResult
    def get_cache_reserve_instances_output(cache_reserve_instance_id: pulumi.Input[Optional[str]] = None,
                                    ids: pulumi.Input[Optional[Sequence[pulumi.Input[str]]]] = None,
                                    output_file: pulumi.Input[Optional[str]] = None,
                                    sort_by: pulumi.Input[Optional[str]] = None,
                                    sort_order: pulumi.Input[Optional[str]] = None,
                                    status: pulumi.Input[Optional[str]] = None,
                                    opts: Optional[InvokeOptions] = None) -> Output[GetCacheReserveInstancesResult]
    func GetCacheReserveInstances(ctx *Context, args *GetCacheReserveInstancesArgs, opts ...InvokeOption) (*GetCacheReserveInstancesResult, error)
    func GetCacheReserveInstancesOutput(ctx *Context, args *GetCacheReserveInstancesOutputArgs, opts ...InvokeOption) GetCacheReserveInstancesResultOutput

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

    public static class GetCacheReserveInstances 
    {
        public static Task<GetCacheReserveInstancesResult> InvokeAsync(GetCacheReserveInstancesArgs args, InvokeOptions? opts = null)
        public static Output<GetCacheReserveInstancesResult> Invoke(GetCacheReserveInstancesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetCacheReserveInstancesResult> getCacheReserveInstances(GetCacheReserveInstancesArgs args, InvokeOptions options)
    public static Output<GetCacheReserveInstancesResult> getCacheReserveInstances(GetCacheReserveInstancesArgs args, InvokeOptions options)
    
    fn::invoke:
      function: alicloud:esa/getCacheReserveInstances:getCacheReserveInstances
      arguments:
        # arguments dictionary
    data "alicloud_esa_get_cache_reserve_instances" "name" {
        # arguments
    }

    The following arguments are supported:

    CacheReserveInstanceId string
    The ID of the Cache Reserve Instance.
    Ids List<string>
    A list of Cache Reserve Instance IDs.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    SortBy string
    The field to sort the results by. Valid values: CreateTime, ExpireTime.
    SortOrder string
    The sort order. Valid values: asc, desc.
    Status string
    The status of the cache reserve instance. Valid values: online, offline, disable, overdue.
    CacheReserveInstanceId string
    The ID of the Cache Reserve Instance.
    Ids []string
    A list of Cache Reserve Instance IDs.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    SortBy string
    The field to sort the results by. Valid values: CreateTime, ExpireTime.
    SortOrder string
    The sort order. Valid values: asc, desc.
    Status string
    The status of the cache reserve instance. Valid values: online, offline, disable, overdue.
    cache_reserve_instance_id string
    The ID of the Cache Reserve Instance.
    ids list(string)
    A list of Cache Reserve Instance IDs.
    output_file string
    File name where to save data source results (after running pulumi preview).
    sort_by string
    The field to sort the results by. Valid values: CreateTime, ExpireTime.
    sort_order string
    The sort order. Valid values: asc, desc.
    status string
    The status of the cache reserve instance. Valid values: online, offline, disable, overdue.
    cacheReserveInstanceId String
    The ID of the Cache Reserve Instance.
    ids List<String>
    A list of Cache Reserve Instance IDs.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    sortBy String
    The field to sort the results by. Valid values: CreateTime, ExpireTime.
    sortOrder String
    The sort order. Valid values: asc, desc.
    status String
    The status of the cache reserve instance. Valid values: online, offline, disable, overdue.
    cacheReserveInstanceId string
    The ID of the Cache Reserve Instance.
    ids string[]
    A list of Cache Reserve Instance IDs.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    sortBy string
    The field to sort the results by. Valid values: CreateTime, ExpireTime.
    sortOrder string
    The sort order. Valid values: asc, desc.
    status string
    The status of the cache reserve instance. Valid values: online, offline, disable, overdue.
    cache_reserve_instance_id str
    The ID of the Cache Reserve Instance.
    ids Sequence[str]
    A list of Cache Reserve Instance IDs.
    output_file str
    File name where to save data source results (after running pulumi preview).
    sort_by str
    The field to sort the results by. Valid values: CreateTime, ExpireTime.
    sort_order str
    The sort order. Valid values: asc, desc.
    status str
    The status of the cache reserve instance. Valid values: online, offline, disable, overdue.
    cacheReserveInstanceId String
    The ID of the Cache Reserve Instance.
    ids List<String>
    A list of Cache Reserve Instance IDs.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    sortBy String
    The field to sort the results by. Valid values: CreateTime, ExpireTime.
    sortOrder String
    The sort order. Valid values: asc, desc.
    status String
    The status of the cache reserve instance. Valid values: online, offline, disable, overdue.

    getCacheReserveInstances Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Instances List<Pulumi.AliCloud.Esa.Outputs.GetCacheReserveInstancesInstance>
    A list of Cache Reserve Instances. Each element contains the following attributes:
    CacheReserveInstanceId string
    The ID of the Cache Reserve Instance.
    Ids List<string>
    OutputFile string
    SortBy string
    SortOrder string
    Status string
    The status of the instance.
    Id string
    The provider-assigned unique ID for this managed resource.
    Instances []GetCacheReserveInstancesInstance
    A list of Cache Reserve Instances. Each element contains the following attributes:
    CacheReserveInstanceId string
    The ID of the Cache Reserve Instance.
    Ids []string
    OutputFile string
    SortBy string
    SortOrder string
    Status string
    The status of the instance.
    id string
    The provider-assigned unique ID for this managed resource.
    instances list(object)
    A list of Cache Reserve Instances. Each element contains the following attributes:
    cache_reserve_instance_id string
    The ID of the Cache Reserve Instance.
    ids list(string)
    output_file string
    sort_by string
    sort_order string
    status string
    The status of the instance.
    id String
    The provider-assigned unique ID for this managed resource.
    instances List<GetCacheReserveInstancesInstance>
    A list of Cache Reserve Instances. Each element contains the following attributes:
    cacheReserveInstanceId String
    The ID of the Cache Reserve Instance.
    ids List<String>
    outputFile String
    sortBy String
    sortOrder String
    status String
    The status of the instance.
    id string
    The provider-assigned unique ID for this managed resource.
    instances GetCacheReserveInstancesInstance[]
    A list of Cache Reserve Instances. Each element contains the following attributes:
    cacheReserveInstanceId string
    The ID of the Cache Reserve Instance.
    ids string[]
    outputFile string
    sortBy string
    sortOrder string
    status string
    The status of the instance.
    id str
    The provider-assigned unique ID for this managed resource.
    instances Sequence[GetCacheReserveInstancesInstance]
    A list of Cache Reserve Instances. Each element contains the following attributes:
    cache_reserve_instance_id str
    The ID of the Cache Reserve Instance.
    ids Sequence[str]
    output_file str
    sort_by str
    sort_order str
    status str
    The status of the instance.
    id String
    The provider-assigned unique ID for this managed resource.
    instances List<Property Map>
    A list of Cache Reserve Instances. Each element contains the following attributes:
    cacheReserveInstanceId String
    The ID of the Cache Reserve Instance.
    ids List<String>
    outputFile String
    sortBy String
    sortOrder String
    status String
    The status of the instance.

    Supporting Types

    GetCacheReserveInstancesInstance

    CacheReserveInstanceId string
    The ID of the Cache Reserve Instance.
    CrRegion string
    The region where the cache reserve instance is used.
    CreateTime string
    The time when the instance was created.
    ExpireTime string
    The expiration time of the instance.
    Id string
    The ID of the Cache Reserve Instance.
    PaymentType string
    The payment type of the resource.
    Period int
    The purchase duration of the instance, in months.
    QuotaGb int
    The cache reserve capacity, in GB.
    Status string
    The status of the cache reserve instance. Valid values: online, offline, disable, overdue.
    CacheReserveInstanceId string
    The ID of the Cache Reserve Instance.
    CrRegion string
    The region where the cache reserve instance is used.
    CreateTime string
    The time when the instance was created.
    ExpireTime string
    The expiration time of the instance.
    Id string
    The ID of the Cache Reserve Instance.
    PaymentType string
    The payment type of the resource.
    Period int
    The purchase duration of the instance, in months.
    QuotaGb int
    The cache reserve capacity, in GB.
    Status string
    The status of the cache reserve instance. Valid values: online, offline, disable, overdue.
    cache_reserve_instance_id string
    The ID of the Cache Reserve Instance.
    cr_region string
    The region where the cache reserve instance is used.
    create_time string
    The time when the instance was created.
    expire_time string
    The expiration time of the instance.
    id string
    The ID of the Cache Reserve Instance.
    payment_type string
    The payment type of the resource.
    period number
    The purchase duration of the instance, in months.
    quota_gb number
    The cache reserve capacity, in GB.
    status string
    The status of the cache reserve instance. Valid values: online, offline, disable, overdue.
    cacheReserveInstanceId String
    The ID of the Cache Reserve Instance.
    crRegion String
    The region where the cache reserve instance is used.
    createTime String
    The time when the instance was created.
    expireTime String
    The expiration time of the instance.
    id String
    The ID of the Cache Reserve Instance.
    paymentType String
    The payment type of the resource.
    period Integer
    The purchase duration of the instance, in months.
    quotaGb Integer
    The cache reserve capacity, in GB.
    status String
    The status of the cache reserve instance. Valid values: online, offline, disable, overdue.
    cacheReserveInstanceId string
    The ID of the Cache Reserve Instance.
    crRegion string
    The region where the cache reserve instance is used.
    createTime string
    The time when the instance was created.
    expireTime string
    The expiration time of the instance.
    id string
    The ID of the Cache Reserve Instance.
    paymentType string
    The payment type of the resource.
    period number
    The purchase duration of the instance, in months.
    quotaGb number
    The cache reserve capacity, in GB.
    status string
    The status of the cache reserve instance. Valid values: online, offline, disable, overdue.
    cache_reserve_instance_id str
    The ID of the Cache Reserve Instance.
    cr_region str
    The region where the cache reserve instance is used.
    create_time str
    The time when the instance was created.
    expire_time str
    The expiration time of the instance.
    id str
    The ID of the Cache Reserve Instance.
    payment_type str
    The payment type of the resource.
    period int
    The purchase duration of the instance, in months.
    quota_gb int
    The cache reserve capacity, in GB.
    status str
    The status of the cache reserve instance. Valid values: online, offline, disable, overdue.
    cacheReserveInstanceId String
    The ID of the Cache Reserve Instance.
    crRegion String
    The region where the cache reserve instance is used.
    createTime String
    The time when the instance was created.
    expireTime String
    The expiration time of the instance.
    id String
    The ID of the Cache Reserve Instance.
    paymentType String
    The payment type of the resource.
    period Number
    The purchase duration of the instance, in months.
    quotaGb Number
    The cache reserve capacity, in GB.
    status String
    The status of the cache reserve instance. Valid values: online, offline, disable, overdue.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Viewing docs for Alibaba Cloud v3.105.0
    published on Thursday, Jul 16, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial