volcengine.ebs.AutoSnapshotPolicyAttachment
Explore with Pulumi AI
Provides a resource to manage ebs auto snapshot policy attachment
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as volcengine from "@pulumi/volcengine";
import * as volcengine from "@volcengine/pulumi";
const fooZones = volcengine.ecs.Zones({});
const fooVolume = new volcengine.ebs.Volume("fooVolume", {
volumeName: "acc-test-volume",
volumeType: "ESSD_PL0",
description: "acc-test",
kind: "data",
size: 500,
zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
volumeChargeType: "PostPaid",
projectName: "default",
});
const fooAutoSnapshotPolicy = new volcengine.ebs.AutoSnapshotPolicy("fooAutoSnapshotPolicy", {
autoSnapshotPolicyName: "acc-test-auto-snapshot-policy",
timePoints: [
"1",
"5",
"9",
],
retentionDays: -1,
repeatWeekdays: [
"2",
"6",
],
projectName: "default",
tags: [{
key: "k1",
value: "v1",
}],
});
const fooAutoSnapshotPolicyAttachment = new volcengine.ebs.AutoSnapshotPolicyAttachment("fooAutoSnapshotPolicyAttachment", {
autoSnapshotPolicyId: fooAutoSnapshotPolicy.id,
volumeId: fooVolume.id,
});
import pulumi
import pulumi_volcengine as volcengine
foo_zones = volcengine.ecs.zones()
foo_volume = volcengine.ebs.Volume("fooVolume",
volume_name="acc-test-volume",
volume_type="ESSD_PL0",
description="acc-test",
kind="data",
size=500,
zone_id=foo_zones.zones[0].id,
volume_charge_type="PostPaid",
project_name="default")
foo_auto_snapshot_policy = volcengine.ebs.AutoSnapshotPolicy("fooAutoSnapshotPolicy",
auto_snapshot_policy_name="acc-test-auto-snapshot-policy",
time_points=[
"1",
"5",
"9",
],
retention_days=-1,
repeat_weekdays=[
"2",
"6",
],
project_name="default",
tags=[volcengine.ebs.AutoSnapshotPolicyTagArgs(
key="k1",
value="v1",
)])
foo_auto_snapshot_policy_attachment = volcengine.ebs.AutoSnapshotPolicyAttachment("fooAutoSnapshotPolicyAttachment",
auto_snapshot_policy_id=foo_auto_snapshot_policy.id,
volume_id=foo_volume.id)
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/ebs"
"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/ecs"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
fooZones, err := ecs.Zones(ctx, nil, nil)
if err != nil {
return err
}
fooVolume, err := ebs.NewVolume(ctx, "fooVolume", &ebs.VolumeArgs{
VolumeName: pulumi.String("acc-test-volume"),
VolumeType: pulumi.String("ESSD_PL0"),
Description: pulumi.String("acc-test"),
Kind: pulumi.String("data"),
Size: pulumi.Int(500),
ZoneId: pulumi.String(fooZones.Zones[0].Id),
VolumeChargeType: pulumi.String("PostPaid"),
ProjectName: pulumi.String("default"),
})
if err != nil {
return err
}
fooAutoSnapshotPolicy, err := ebs.NewAutoSnapshotPolicy(ctx, "fooAutoSnapshotPolicy", &ebs.AutoSnapshotPolicyArgs{
AutoSnapshotPolicyName: pulumi.String("acc-test-auto-snapshot-policy"),
TimePoints: pulumi.StringArray{
pulumi.String("1"),
pulumi.String("5"),
pulumi.String("9"),
},
RetentionDays: -1,
RepeatWeekdays: pulumi.StringArray{
pulumi.String("2"),
pulumi.String("6"),
},
ProjectName: pulumi.String("default"),
Tags: ebs.AutoSnapshotPolicyTagArray{
&ebs.AutoSnapshotPolicyTagArgs{
Key: pulumi.String("k1"),
Value: pulumi.String("v1"),
},
},
})
if err != nil {
return err
}
_, err = ebs.NewAutoSnapshotPolicyAttachment(ctx, "fooAutoSnapshotPolicyAttachment", &ebs.AutoSnapshotPolicyAttachmentArgs{
AutoSnapshotPolicyId: fooAutoSnapshotPolicy.ID(),
VolumeId: fooVolume.ID(),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Volcengine = Pulumi.Volcengine;
return await Deployment.RunAsync(() =>
{
var fooZones = Volcengine.Ecs.Zones.Invoke();
var fooVolume = new Volcengine.Ebs.Volume("fooVolume", new()
{
VolumeName = "acc-test-volume",
VolumeType = "ESSD_PL0",
Description = "acc-test",
Kind = "data",
Size = 500,
ZoneId = fooZones.Apply(zonesResult => zonesResult.Zones[0]?.Id),
VolumeChargeType = "PostPaid",
ProjectName = "default",
});
var fooAutoSnapshotPolicy = new Volcengine.Ebs.AutoSnapshotPolicy("fooAutoSnapshotPolicy", new()
{
AutoSnapshotPolicyName = "acc-test-auto-snapshot-policy",
TimePoints = new[]
{
"1",
"5",
"9",
},
RetentionDays = -1,
RepeatWeekdays = new[]
{
"2",
"6",
},
ProjectName = "default",
Tags = new[]
{
new Volcengine.Ebs.Inputs.AutoSnapshotPolicyTagArgs
{
Key = "k1",
Value = "v1",
},
},
});
var fooAutoSnapshotPolicyAttachment = new Volcengine.Ebs.AutoSnapshotPolicyAttachment("fooAutoSnapshotPolicyAttachment", new()
{
AutoSnapshotPolicyId = fooAutoSnapshotPolicy.Id,
VolumeId = fooVolume.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.volcengine.ecs.EcsFunctions;
import com.pulumi.volcengine.ecs.inputs.ZonesArgs;
import com.pulumi.volcengine.ebs.Volume;
import com.pulumi.volcengine.ebs.VolumeArgs;
import com.pulumi.volcengine.ebs.AutoSnapshotPolicy;
import com.pulumi.volcengine.ebs.AutoSnapshotPolicyArgs;
import com.pulumi.volcengine.ebs.inputs.AutoSnapshotPolicyTagArgs;
import com.pulumi.volcengine.ebs.AutoSnapshotPolicyAttachment;
import com.pulumi.volcengine.ebs.AutoSnapshotPolicyAttachmentArgs;
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 fooZones = EcsFunctions.Zones();
var fooVolume = new Volume("fooVolume", VolumeArgs.builder()
.volumeName("acc-test-volume")
.volumeType("ESSD_PL0")
.description("acc-test")
.kind("data")
.size(500)
.zoneId(fooZones.applyValue(zonesResult -> zonesResult.zones()[0].id()))
.volumeChargeType("PostPaid")
.projectName("default")
.build());
var fooAutoSnapshotPolicy = new AutoSnapshotPolicy("fooAutoSnapshotPolicy", AutoSnapshotPolicyArgs.builder()
.autoSnapshotPolicyName("acc-test-auto-snapshot-policy")
.timePoints(
1,
5,
9)
.retentionDays("TODO: GenUnaryOpExpression")
.repeatWeekdays(
2,
6)
.projectName("default")
.tags(AutoSnapshotPolicyTagArgs.builder()
.key("k1")
.value("v1")
.build())
.build());
var fooAutoSnapshotPolicyAttachment = new AutoSnapshotPolicyAttachment("fooAutoSnapshotPolicyAttachment", AutoSnapshotPolicyAttachmentArgs.builder()
.autoSnapshotPolicyId(fooAutoSnapshotPolicy.id())
.volumeId(fooVolume.id())
.build());
}
}
Coming soon!
Create AutoSnapshotPolicyAttachment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new AutoSnapshotPolicyAttachment(name: string, args: AutoSnapshotPolicyAttachmentArgs, opts?: CustomResourceOptions);
@overload
def AutoSnapshotPolicyAttachment(resource_name: str,
args: AutoSnapshotPolicyAttachmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def AutoSnapshotPolicyAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
auto_snapshot_policy_id: Optional[str] = None,
volume_id: Optional[str] = None)
func NewAutoSnapshotPolicyAttachment(ctx *Context, name string, args AutoSnapshotPolicyAttachmentArgs, opts ...ResourceOption) (*AutoSnapshotPolicyAttachment, error)
public AutoSnapshotPolicyAttachment(string name, AutoSnapshotPolicyAttachmentArgs args, CustomResourceOptions? opts = null)
public AutoSnapshotPolicyAttachment(String name, AutoSnapshotPolicyAttachmentArgs args)
public AutoSnapshotPolicyAttachment(String name, AutoSnapshotPolicyAttachmentArgs args, CustomResourceOptions options)
type: volcengine:ebs:AutoSnapshotPolicyAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args AutoSnapshotPolicyAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args AutoSnapshotPolicyAttachmentArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args AutoSnapshotPolicyAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args AutoSnapshotPolicyAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args AutoSnapshotPolicyAttachmentArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var autoSnapshotPolicyAttachmentResource = new Volcengine.Ebs.AutoSnapshotPolicyAttachment("autoSnapshotPolicyAttachmentResource", new()
{
AutoSnapshotPolicyId = "string",
VolumeId = "string",
});
example, err := ebs.NewAutoSnapshotPolicyAttachment(ctx, "autoSnapshotPolicyAttachmentResource", &ebs.AutoSnapshotPolicyAttachmentArgs{
AutoSnapshotPolicyId: pulumi.String("string"),
VolumeId: pulumi.String("string"),
})
var autoSnapshotPolicyAttachmentResource = new AutoSnapshotPolicyAttachment("autoSnapshotPolicyAttachmentResource", AutoSnapshotPolicyAttachmentArgs.builder()
.autoSnapshotPolicyId("string")
.volumeId("string")
.build());
auto_snapshot_policy_attachment_resource = volcengine.ebs.AutoSnapshotPolicyAttachment("autoSnapshotPolicyAttachmentResource",
auto_snapshot_policy_id="string",
volume_id="string")
const autoSnapshotPolicyAttachmentResource = new volcengine.ebs.AutoSnapshotPolicyAttachment("autoSnapshotPolicyAttachmentResource", {
autoSnapshotPolicyId: "string",
volumeId: "string",
});
type: volcengine:ebs:AutoSnapshotPolicyAttachment
properties:
autoSnapshotPolicyId: string
volumeId: string
AutoSnapshotPolicyAttachment Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The AutoSnapshotPolicyAttachment resource accepts the following input properties:
- Auto
Snapshot stringPolicy Id - The id of the auto snapshot policy.
- Volume
Id string - The id of the volume.
- Auto
Snapshot stringPolicy Id - The id of the auto snapshot policy.
- Volume
Id string - The id of the volume.
- auto
Snapshot StringPolicy Id - The id of the auto snapshot policy.
- volume
Id String - The id of the volume.
- auto
Snapshot stringPolicy Id - The id of the auto snapshot policy.
- volume
Id string - The id of the volume.
- auto_
snapshot_ strpolicy_ id - The id of the auto snapshot policy.
- volume_
id str - The id of the volume.
- auto
Snapshot StringPolicy Id - The id of the auto snapshot policy.
- volume
Id String - The id of the volume.
Outputs
All input properties are implicitly available as output properties. Additionally, the AutoSnapshotPolicyAttachment resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing AutoSnapshotPolicyAttachment Resource
Get an existing AutoSnapshotPolicyAttachment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: AutoSnapshotPolicyAttachmentState, opts?: CustomResourceOptions): AutoSnapshotPolicyAttachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
auto_snapshot_policy_id: Optional[str] = None,
volume_id: Optional[str] = None) -> AutoSnapshotPolicyAttachment
func GetAutoSnapshotPolicyAttachment(ctx *Context, name string, id IDInput, state *AutoSnapshotPolicyAttachmentState, opts ...ResourceOption) (*AutoSnapshotPolicyAttachment, error)
public static AutoSnapshotPolicyAttachment Get(string name, Input<string> id, AutoSnapshotPolicyAttachmentState? state, CustomResourceOptions? opts = null)
public static AutoSnapshotPolicyAttachment get(String name, Output<String> id, AutoSnapshotPolicyAttachmentState state, CustomResourceOptions options)
resources: _: type: volcengine:ebs:AutoSnapshotPolicyAttachment get: id: ${id}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Auto
Snapshot stringPolicy Id - The id of the auto snapshot policy.
- Volume
Id string - The id of the volume.
- Auto
Snapshot stringPolicy Id - The id of the auto snapshot policy.
- Volume
Id string - The id of the volume.
- auto
Snapshot StringPolicy Id - The id of the auto snapshot policy.
- volume
Id String - The id of the volume.
- auto
Snapshot stringPolicy Id - The id of the auto snapshot policy.
- volume
Id string - The id of the volume.
- auto_
snapshot_ strpolicy_ id - The id of the auto snapshot policy.
- volume_
id str - The id of the volume.
- auto
Snapshot StringPolicy Id - The id of the auto snapshot policy.
- volume
Id String - The id of the volume.
Import
EbsAutoSnapshotPolicyAttachment can be imported using the auto_snapshot_policy_id:volume_id, e.g.
$ pulumi import volcengine:ebs/autoSnapshotPolicyAttachment:AutoSnapshotPolicyAttachment default resource_id
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- volcengine volcengine/pulumi-volcengine
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
volcengine
Terraform Provider.