tencentcloud.VpcSnapshotPolicyAttachment
Explore with Pulumi AI
Provides a resource to create a vpc snapshot_policy_attachment
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";
const exampleCosBucket = new tencentcloud.CosBucket("exampleCosBucket", {
bucket: "tf-example-1308919341",
acl: "private",
});
const exampleVpcSnapshotPolicy = new tencentcloud.VpcSnapshotPolicy("exampleVpcSnapshotPolicy", {
snapshotPolicyName: "tf-example",
backupType: "time",
cosBucket: exampleCosBucket.bucket,
cosRegion: "ap-guangzhou",
createNewCos: false,
keepTime: 2,
backupPolicies: [
{
backupDay: "monday",
backupTime: "00:00:00",
},
{
backupDay: "tuesday",
backupTime: "01:00:00",
},
{
backupDay: "wednesday",
backupTime: "02:00:00",
},
],
});
const exampleSecurityGroup = new tencentcloud.SecurityGroup("exampleSecurityGroup", {description: "desc."});
const attachment = new tencentcloud.VpcSnapshotPolicyAttachment("attachment", {
snapshotPolicyId: exampleVpcSnapshotPolicy.vpcSnapshotPolicyId,
instances: [{
instanceType: "securitygroup",
instanceId: exampleSecurityGroup.securityGroupId,
instanceName: "tf-example",
instanceRegion: "ap-guangzhou",
}],
});
import pulumi
import pulumi_tencentcloud as tencentcloud
example_cos_bucket = tencentcloud.CosBucket("exampleCosBucket",
bucket="tf-example-1308919341",
acl="private")
example_vpc_snapshot_policy = tencentcloud.VpcSnapshotPolicy("exampleVpcSnapshotPolicy",
snapshot_policy_name="tf-example",
backup_type="time",
cos_bucket=example_cos_bucket.bucket,
cos_region="ap-guangzhou",
create_new_cos=False,
keep_time=2,
backup_policies=[
{
"backup_day": "monday",
"backup_time": "00:00:00",
},
{
"backup_day": "tuesday",
"backup_time": "01:00:00",
},
{
"backup_day": "wednesday",
"backup_time": "02:00:00",
},
])
example_security_group = tencentcloud.SecurityGroup("exampleSecurityGroup", description="desc.")
attachment = tencentcloud.VpcSnapshotPolicyAttachment("attachment",
snapshot_policy_id=example_vpc_snapshot_policy.vpc_snapshot_policy_id,
instances=[{
"instance_type": "securitygroup",
"instance_id": example_security_group.security_group_id,
"instance_name": "tf-example",
"instance_region": "ap-guangzhou",
}])
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 {
exampleCosBucket, err := tencentcloud.NewCosBucket(ctx, "exampleCosBucket", &tencentcloud.CosBucketArgs{
Bucket: pulumi.String("tf-example-1308919341"),
Acl: pulumi.String("private"),
})
if err != nil {
return err
}
exampleVpcSnapshotPolicy, err := tencentcloud.NewVpcSnapshotPolicy(ctx, "exampleVpcSnapshotPolicy", &tencentcloud.VpcSnapshotPolicyArgs{
SnapshotPolicyName: pulumi.String("tf-example"),
BackupType: pulumi.String("time"),
CosBucket: exampleCosBucket.Bucket,
CosRegion: pulumi.String("ap-guangzhou"),
CreateNewCos: pulumi.Bool(false),
KeepTime: pulumi.Float64(2),
BackupPolicies: tencentcloud.VpcSnapshotPolicyBackupPolicyArray{
&tencentcloud.VpcSnapshotPolicyBackupPolicyArgs{
BackupDay: pulumi.String("monday"),
BackupTime: pulumi.String("00:00:00"),
},
&tencentcloud.VpcSnapshotPolicyBackupPolicyArgs{
BackupDay: pulumi.String("tuesday"),
BackupTime: pulumi.String("01:00:00"),
},
&tencentcloud.VpcSnapshotPolicyBackupPolicyArgs{
BackupDay: pulumi.String("wednesday"),
BackupTime: pulumi.String("02:00:00"),
},
},
})
if err != nil {
return err
}
exampleSecurityGroup, err := tencentcloud.NewSecurityGroup(ctx, "exampleSecurityGroup", &tencentcloud.SecurityGroupArgs{
Description: pulumi.String("desc."),
})
if err != nil {
return err
}
_, err = tencentcloud.NewVpcSnapshotPolicyAttachment(ctx, "attachment", &tencentcloud.VpcSnapshotPolicyAttachmentArgs{
SnapshotPolicyId: exampleVpcSnapshotPolicy.VpcSnapshotPolicyId,
Instances: tencentcloud.VpcSnapshotPolicyAttachmentInstanceArray{
&tencentcloud.VpcSnapshotPolicyAttachmentInstanceArgs{
InstanceType: pulumi.String("securitygroup"),
InstanceId: exampleSecurityGroup.SecurityGroupId,
InstanceName: pulumi.String("tf-example"),
InstanceRegion: pulumi.String("ap-guangzhou"),
},
},
})
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 exampleCosBucket = new Tencentcloud.CosBucket("exampleCosBucket", new()
{
Bucket = "tf-example-1308919341",
Acl = "private",
});
var exampleVpcSnapshotPolicy = new Tencentcloud.VpcSnapshotPolicy("exampleVpcSnapshotPolicy", new()
{
SnapshotPolicyName = "tf-example",
BackupType = "time",
CosBucket = exampleCosBucket.Bucket,
CosRegion = "ap-guangzhou",
CreateNewCos = false,
KeepTime = 2,
BackupPolicies = new[]
{
new Tencentcloud.Inputs.VpcSnapshotPolicyBackupPolicyArgs
{
BackupDay = "monday",
BackupTime = "00:00:00",
},
new Tencentcloud.Inputs.VpcSnapshotPolicyBackupPolicyArgs
{
BackupDay = "tuesday",
BackupTime = "01:00:00",
},
new Tencentcloud.Inputs.VpcSnapshotPolicyBackupPolicyArgs
{
BackupDay = "wednesday",
BackupTime = "02:00:00",
},
},
});
var exampleSecurityGroup = new Tencentcloud.SecurityGroup("exampleSecurityGroup", new()
{
Description = "desc.",
});
var attachment = new Tencentcloud.VpcSnapshotPolicyAttachment("attachment", new()
{
SnapshotPolicyId = exampleVpcSnapshotPolicy.VpcSnapshotPolicyId,
Instances = new[]
{
new Tencentcloud.Inputs.VpcSnapshotPolicyAttachmentInstanceArgs
{
InstanceType = "securitygroup",
InstanceId = exampleSecurityGroup.SecurityGroupId,
InstanceName = "tf-example",
InstanceRegion = "ap-guangzhou",
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.CosBucket;
import com.pulumi.tencentcloud.CosBucketArgs;
import com.pulumi.tencentcloud.VpcSnapshotPolicy;
import com.pulumi.tencentcloud.VpcSnapshotPolicyArgs;
import com.pulumi.tencentcloud.inputs.VpcSnapshotPolicyBackupPolicyArgs;
import com.pulumi.tencentcloud.SecurityGroup;
import com.pulumi.tencentcloud.SecurityGroupArgs;
import com.pulumi.tencentcloud.VpcSnapshotPolicyAttachment;
import com.pulumi.tencentcloud.VpcSnapshotPolicyAttachmentArgs;
import com.pulumi.tencentcloud.inputs.VpcSnapshotPolicyAttachmentInstanceArgs;
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) {
var exampleCosBucket = new CosBucket("exampleCosBucket", CosBucketArgs.builder()
.bucket("tf-example-1308919341")
.acl("private")
.build());
var exampleVpcSnapshotPolicy = new VpcSnapshotPolicy("exampleVpcSnapshotPolicy", VpcSnapshotPolicyArgs.builder()
.snapshotPolicyName("tf-example")
.backupType("time")
.cosBucket(exampleCosBucket.bucket())
.cosRegion("ap-guangzhou")
.createNewCos(false)
.keepTime(2)
.backupPolicies(
VpcSnapshotPolicyBackupPolicyArgs.builder()
.backupDay("monday")
.backupTime("00:00:00")
.build(),
VpcSnapshotPolicyBackupPolicyArgs.builder()
.backupDay("tuesday")
.backupTime("01:00:00")
.build(),
VpcSnapshotPolicyBackupPolicyArgs.builder()
.backupDay("wednesday")
.backupTime("02:00:00")
.build())
.build());
var exampleSecurityGroup = new SecurityGroup("exampleSecurityGroup", SecurityGroupArgs.builder()
.description("desc.")
.build());
var attachment = new VpcSnapshotPolicyAttachment("attachment", VpcSnapshotPolicyAttachmentArgs.builder()
.snapshotPolicyId(exampleVpcSnapshotPolicy.vpcSnapshotPolicyId())
.instances(VpcSnapshotPolicyAttachmentInstanceArgs.builder()
.instanceType("securitygroup")
.instanceId(exampleSecurityGroup.securityGroupId())
.instanceName("tf-example")
.instanceRegion("ap-guangzhou")
.build())
.build());
}
}
resources:
exampleCosBucket:
type: tencentcloud:CosBucket
properties:
bucket: tf-example-1308919341
acl: private
exampleVpcSnapshotPolicy:
type: tencentcloud:VpcSnapshotPolicy
properties:
snapshotPolicyName: tf-example
backupType: time
cosBucket: ${exampleCosBucket.bucket}
cosRegion: ap-guangzhou
createNewCos: false
keepTime: 2
backupPolicies:
- backupDay: monday
backupTime: 00:00:00
- backupDay: tuesday
backupTime: 01:00:00
- backupDay: wednesday
backupTime: 02:00:00
exampleSecurityGroup:
type: tencentcloud:SecurityGroup
properties:
description: desc.
attachment:
type: tencentcloud:VpcSnapshotPolicyAttachment
properties:
snapshotPolicyId: ${exampleVpcSnapshotPolicy.vpcSnapshotPolicyId}
instances:
- instanceType: securitygroup
instanceId: ${exampleSecurityGroup.securityGroupId}
instanceName: tf-example
instanceRegion: ap-guangzhou
Create VpcSnapshotPolicyAttachment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new VpcSnapshotPolicyAttachment(name: string, args: VpcSnapshotPolicyAttachmentArgs, opts?: CustomResourceOptions);
@overload
def VpcSnapshotPolicyAttachment(resource_name: str,
args: VpcSnapshotPolicyAttachmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def VpcSnapshotPolicyAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
instances: Optional[Sequence[VpcSnapshotPolicyAttachmentInstanceArgs]] = None,
snapshot_policy_id: Optional[str] = None,
vpc_snapshot_policy_attachment_id: Optional[str] = None)
func NewVpcSnapshotPolicyAttachment(ctx *Context, name string, args VpcSnapshotPolicyAttachmentArgs, opts ...ResourceOption) (*VpcSnapshotPolicyAttachment, error)
public VpcSnapshotPolicyAttachment(string name, VpcSnapshotPolicyAttachmentArgs args, CustomResourceOptions? opts = null)
public VpcSnapshotPolicyAttachment(String name, VpcSnapshotPolicyAttachmentArgs args)
public VpcSnapshotPolicyAttachment(String name, VpcSnapshotPolicyAttachmentArgs args, CustomResourceOptions options)
type: tencentcloud:VpcSnapshotPolicyAttachment
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 VpcSnapshotPolicyAttachmentArgs
- 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 VpcSnapshotPolicyAttachmentArgs
- 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 VpcSnapshotPolicyAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args VpcSnapshotPolicyAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args VpcSnapshotPolicyAttachmentArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
VpcSnapshotPolicyAttachment 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 VpcSnapshotPolicyAttachment resource accepts the following input properties:
- Instances
List<Vpc
Snapshot Policy Attachment Instance> - Associated instance information.
- Snapshot
Policy stringId - Snapshot policy Id.
- Vpc
Snapshot stringPolicy Attachment Id - ID of the resource.
- Instances
[]Vpc
Snapshot Policy Attachment Instance Args - Associated instance information.
- Snapshot
Policy stringId - Snapshot policy Id.
- Vpc
Snapshot stringPolicy Attachment Id - ID of the resource.
- instances
List<Vpc
Snapshot Policy Attachment Instance> - Associated instance information.
- snapshot
Policy StringId - Snapshot policy Id.
- vpc
Snapshot StringPolicy Attachment Id - ID of the resource.
- instances
Vpc
Snapshot Policy Attachment Instance[] - Associated instance information.
- snapshot
Policy stringId - Snapshot policy Id.
- vpc
Snapshot stringPolicy Attachment Id - ID of the resource.
- instances
Sequence[Vpc
Snapshot Policy Attachment Instance Args] - Associated instance information.
- snapshot_
policy_ strid - Snapshot policy Id.
- vpc_
snapshot_ strpolicy_ attachment_ id - ID of the resource.
- instances List<Property Map>
- Associated instance information.
- snapshot
Policy StringId - Snapshot policy Id.
- vpc
Snapshot StringPolicy Attachment Id - ID of the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the VpcSnapshotPolicyAttachment 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 VpcSnapshotPolicyAttachment Resource
Get an existing VpcSnapshotPolicyAttachment 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?: VpcSnapshotPolicyAttachmentState, opts?: CustomResourceOptions): VpcSnapshotPolicyAttachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
instances: Optional[Sequence[VpcSnapshotPolicyAttachmentInstanceArgs]] = None,
snapshot_policy_id: Optional[str] = None,
vpc_snapshot_policy_attachment_id: Optional[str] = None) -> VpcSnapshotPolicyAttachment
func GetVpcSnapshotPolicyAttachment(ctx *Context, name string, id IDInput, state *VpcSnapshotPolicyAttachmentState, opts ...ResourceOption) (*VpcSnapshotPolicyAttachment, error)
public static VpcSnapshotPolicyAttachment Get(string name, Input<string> id, VpcSnapshotPolicyAttachmentState? state, CustomResourceOptions? opts = null)
public static VpcSnapshotPolicyAttachment get(String name, Output<String> id, VpcSnapshotPolicyAttachmentState state, CustomResourceOptions options)
resources: _: type: tencentcloud:VpcSnapshotPolicyAttachment 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.
- Instances
List<Vpc
Snapshot Policy Attachment Instance> - Associated instance information.
- Snapshot
Policy stringId - Snapshot policy Id.
- Vpc
Snapshot stringPolicy Attachment Id - ID of the resource.
- Instances
[]Vpc
Snapshot Policy Attachment Instance Args - Associated instance information.
- Snapshot
Policy stringId - Snapshot policy Id.
- Vpc
Snapshot stringPolicy Attachment Id - ID of the resource.
- instances
List<Vpc
Snapshot Policy Attachment Instance> - Associated instance information.
- snapshot
Policy StringId - Snapshot policy Id.
- vpc
Snapshot StringPolicy Attachment Id - ID of the resource.
- instances
Vpc
Snapshot Policy Attachment Instance[] - Associated instance information.
- snapshot
Policy stringId - Snapshot policy Id.
- vpc
Snapshot stringPolicy Attachment Id - ID of the resource.
- instances
Sequence[Vpc
Snapshot Policy Attachment Instance Args] - Associated instance information.
- snapshot_
policy_ strid - Snapshot policy Id.
- vpc_
snapshot_ strpolicy_ attachment_ id - ID of the resource.
- instances List<Property Map>
- Associated instance information.
- snapshot
Policy StringId - Snapshot policy Id.
- vpc
Snapshot StringPolicy Attachment Id - ID of the resource.
Supporting Types
VpcSnapshotPolicyAttachmentInstance, VpcSnapshotPolicyAttachmentInstanceArgs
- Instance
Id string - InstanceId.
- Instance
Region string - The region where the instance is located.
- Instance
Type string - Instance type, currently supports set:
securitygroup
. - Instance
Name string - Instance name.
- Snapshot
Policy stringId - Snapshot policy Id.
- Instance
Id string - InstanceId.
- Instance
Region string - The region where the instance is located.
- Instance
Type string - Instance type, currently supports set:
securitygroup
. - Instance
Name string - Instance name.
- Snapshot
Policy stringId - Snapshot policy Id.
- instance
Id String - InstanceId.
- instance
Region String - The region where the instance is located.
- instance
Type String - Instance type, currently supports set:
securitygroup
. - instance
Name String - Instance name.
- snapshot
Policy StringId - Snapshot policy Id.
- instance
Id string - InstanceId.
- instance
Region string - The region where the instance is located.
- instance
Type string - Instance type, currently supports set:
securitygroup
. - instance
Name string - Instance name.
- snapshot
Policy stringId - Snapshot policy Id.
- instance_
id str - InstanceId.
- instance_
region str - The region where the instance is located.
- instance_
type str - Instance type, currently supports set:
securitygroup
. - instance_
name str - Instance name.
- snapshot_
policy_ strid - Snapshot policy Id.
- instance
Id String - InstanceId.
- instance
Region String - The region where the instance is located.
- instance
Type String - Instance type, currently supports set:
securitygroup
. - instance
Name String - Instance name.
- snapshot
Policy StringId - Snapshot policy Id.
Import
vpc snapshot_policy_attachment can be imported using the id, e.g.
$ pulumi import tencentcloud:index/vpcSnapshotPolicyAttachment:VpcSnapshotPolicyAttachment snapshot_policy_attachment snapshot_policy_attachment_id
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- tencentcloud tencentcloudstack/terraform-provider-tencentcloud
- License
- Notes
- This Pulumi package is based on the
tencentcloud
Terraform Provider.