get Ecs Snapshots
This data source provides the Ecs Snapshots of the current Alibaba Cloud user.
NOTE: Available in v1.120.0+.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const example = alicloud.ecs.getEcsSnapshots({
ids: ["s-bp1fvuxxxxxxxx"],
nameRegex: "tf-test",
});
export const firstEcsSnapshotId = example.then(example => example.snapshots?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
example = alicloud.ecs.get_ecs_snapshots(ids=["s-bp1fvuxxxxxxxx"],
name_regex="tf-test")
pulumi.export("firstEcsSnapshotId", example.snapshots[0].id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var example = AliCloud.Ecs.GetEcsSnapshots.Invoke(new()
{
Ids = new[]
{
"s-bp1fvuxxxxxxxx",
},
NameRegex = "tf-test",
});
return new Dictionary<string, object?>
{
["firstEcsSnapshotId"] = example.Apply(getEcsSnapshotsResult => getEcsSnapshotsResult.Snapshots[0]?.Id),
};
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := ecs.GetEcsSnapshots(ctx, &ecs.GetEcsSnapshotsArgs{
Ids: []string{
"s-bp1fvuxxxxxxxx",
},
NameRegex: pulumi.StringRef("tf-test"),
}, nil)
if err != nil {
return err
}
ctx.Export("firstEcsSnapshotId", example.Snapshots[0].Id)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.ecs.EcsFunctions;
import com.pulumi.alicloud.ecs.inputs.GetEcsSnapshotsArgs;
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 = EcsFunctions.getEcsSnapshots(GetEcsSnapshotsArgs.builder()
.ids("s-bp1fvuxxxxxxxx")
.nameRegex("tf-test")
.build());
ctx.export("firstEcsSnapshotId", example.snapshots()[0].id());
}
}
variables:
example:
fn::invoke:
function: alicloud:ecs:getEcsSnapshots
arguments:
ids:
- s-bp1fvuxxxxxxxx
nameRegex: tf-test
outputs:
firstEcsSnapshotId: ${example.snapshots[0].id}
Return
A collection of values returned by getEcsSnapshots.
Parameters
A collection of arguments for invoking getEcsSnapshots.
Return
A collection of values returned by getEcsSnapshots.
Parameters
The category of the snapshot. Valid Values: flash
and standard
.
Specifies whether to check the validity of the request without actually making the request.
Specifies whether the snapshot is encrypted.
A list of Snapshot IDs.
The kms key id.
A regex string to filter results by Snapshot name.
File name where to save data source results (after running pulumi preview
).
The resource group id.
The snapshot link id.
The name of the snapshot.
The type of the snapshot. Valid Values: auto
, user
and all
. Default to: all
.
The type of the disk for which the snapshot was created. Valid Values: System
, Data
.
The status of the snapshot. Valid Values: accomplished
, failed
, progressing
and all
.
A mapping of tags to assign to the snapshot.
A resource type that has a reference relationship. Valid Values: image
, disk
, image_disk
and none
.
See also
Return
A collection of values returned by getEcsSnapshots.
Parameters
Builder for com.pulumi.alicloud.ecs.kotlin.inputs.GetEcsSnapshotsPlainArgs.