tencentcloud.CvmActionTimer
Explore with Pulumi AI
Provides a resource to create a CVM instance action timer
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";
const config = new pulumi.Config();
const availabilityZone = config.get("availabilityZone") || "ap-guangzhou-6";
const images = tencentcloud.getImages({
imageTypes: ["PUBLIC_IMAGE"],
imageNameRegex: "TencentOS Server",
});
// create vpc
const vpc = new tencentcloud.Vpc("vpc", {cidrBlock: "10.0.0.0/16"});
// create vpc subnet
const subnet = new tencentcloud.Subnet("subnet", {
vpcId: vpc.vpcId,
availabilityZone: availabilityZone,
cidrBlock: "10.0.20.0/28",
isMulticast: false,
});
// create cvm
const exampleInstance = new tencentcloud.Instance("exampleInstance", {
instanceName: "tf_example",
availabilityZone: availabilityZone,
imageId: images.then(images => images.images?.[0]?.imageId),
instanceType: "SA3.MEDIUM4",
systemDiskType: "CLOUD_HSSD",
systemDiskSize: 100,
hostname: "example",
projectId: 0,
vpcId: vpc.vpcId,
subnetId: subnet.subnetId,
dataDisks: [{
dataDiskType: "CLOUD_HSSD",
dataDiskSize: 50,
encrypt: false,
}],
tags: {
createBy: "terraform",
},
});
// create cvm action timer
const exampleCvmActionTimer = new tencentcloud.CvmActionTimer("exampleCvmActionTimer", {
instanceId: exampleInstance.instanceId,
actionTimer: {
timerAction: "TerminateInstances",
actionTime: "2024-11-11T11:26:40Z",
},
});
import pulumi
import pulumi_tencentcloud as tencentcloud
config = pulumi.Config()
availability_zone = config.get("availabilityZone")
if availability_zone is None:
availability_zone = "ap-guangzhou-6"
images = tencentcloud.get_images(image_types=["PUBLIC_IMAGE"],
image_name_regex="TencentOS Server")
# create vpc
vpc = tencentcloud.Vpc("vpc", cidr_block="10.0.0.0/16")
# create vpc subnet
subnet = tencentcloud.Subnet("subnet",
vpc_id=vpc.vpc_id,
availability_zone=availability_zone,
cidr_block="10.0.20.0/28",
is_multicast=False)
# create cvm
example_instance = tencentcloud.Instance("exampleInstance",
instance_name="tf_example",
availability_zone=availability_zone,
image_id=images.images[0].image_id,
instance_type="SA3.MEDIUM4",
system_disk_type="CLOUD_HSSD",
system_disk_size=100,
hostname="example",
project_id=0,
vpc_id=vpc.vpc_id,
subnet_id=subnet.subnet_id,
data_disks=[{
"data_disk_type": "CLOUD_HSSD",
"data_disk_size": 50,
"encrypt": False,
}],
tags={
"createBy": "terraform",
})
# create cvm action timer
example_cvm_action_timer = tencentcloud.CvmActionTimer("exampleCvmActionTimer",
instance_id=example_instance.instance_id,
action_timer={
"timer_action": "TerminateInstances",
"action_time": "2024-11-11T11:26:40Z",
})
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
"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, "")
availabilityZone := "ap-guangzhou-6"
if param := cfg.Get("availabilityZone"); param != "" {
availabilityZone = param
}
images, err := tencentcloud.GetImages(ctx, &tencentcloud.GetImagesArgs{
ImageTypes: []string{
"PUBLIC_IMAGE",
},
ImageNameRegex: pulumi.StringRef("TencentOS Server"),
}, nil)
if err != nil {
return err
}
// create vpc
vpc, err := tencentcloud.NewVpc(ctx, "vpc", &tencentcloud.VpcArgs{
CidrBlock: pulumi.String("10.0.0.0/16"),
})
if err != nil {
return err
}
// create vpc subnet
subnet, err := tencentcloud.NewSubnet(ctx, "subnet", &tencentcloud.SubnetArgs{
VpcId: vpc.VpcId,
AvailabilityZone: pulumi.String(availabilityZone),
CidrBlock: pulumi.String("10.0.20.0/28"),
IsMulticast: pulumi.Bool(false),
})
if err != nil {
return err
}
// create cvm
exampleInstance, err := tencentcloud.NewInstance(ctx, "exampleInstance", &tencentcloud.InstanceArgs{
InstanceName: pulumi.String("tf_example"),
AvailabilityZone: pulumi.String(availabilityZone),
ImageId: pulumi.String(images.Images[0].ImageId),
InstanceType: pulumi.String("SA3.MEDIUM4"),
SystemDiskType: pulumi.String("CLOUD_HSSD"),
SystemDiskSize: pulumi.Float64(100),
Hostname: pulumi.String("example"),
ProjectId: pulumi.Float64(0),
VpcId: vpc.VpcId,
SubnetId: subnet.SubnetId,
DataDisks: tencentcloud.InstanceDataDiskArray{
&tencentcloud.InstanceDataDiskArgs{
DataDiskType: pulumi.String("CLOUD_HSSD"),
DataDiskSize: pulumi.Float64(50),
Encrypt: pulumi.Bool(false),
},
},
Tags: pulumi.StringMap{
"createBy": pulumi.String("terraform"),
},
})
if err != nil {
return err
}
// create cvm action timer
_, err = tencentcloud.NewCvmActionTimer(ctx, "exampleCvmActionTimer", &tencentcloud.CvmActionTimerArgs{
InstanceId: exampleInstance.InstanceId,
ActionTimer: &tencentcloud.CvmActionTimerActionTimerArgs{
TimerAction: pulumi.String("TerminateInstances"),
ActionTime: pulumi.String("2024-11-11T11:26:40Z"),
},
})
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 config = new Config();
var availabilityZone = config.Get("availabilityZone") ?? "ap-guangzhou-6";
var images = Tencentcloud.GetImages.Invoke(new()
{
ImageTypes = new[]
{
"PUBLIC_IMAGE",
},
ImageNameRegex = "TencentOS Server",
});
// create vpc
var vpc = new Tencentcloud.Vpc("vpc", new()
{
CidrBlock = "10.0.0.0/16",
});
// create vpc subnet
var subnet = new Tencentcloud.Subnet("subnet", new()
{
VpcId = vpc.VpcId,
AvailabilityZone = availabilityZone,
CidrBlock = "10.0.20.0/28",
IsMulticast = false,
});
// create cvm
var exampleInstance = new Tencentcloud.Instance("exampleInstance", new()
{
InstanceName = "tf_example",
AvailabilityZone = availabilityZone,
ImageId = images.Apply(getImagesResult => getImagesResult.Images[0]?.ImageId),
InstanceType = "SA3.MEDIUM4",
SystemDiskType = "CLOUD_HSSD",
SystemDiskSize = 100,
Hostname = "example",
ProjectId = 0,
VpcId = vpc.VpcId,
SubnetId = subnet.SubnetId,
DataDisks = new[]
{
new Tencentcloud.Inputs.InstanceDataDiskArgs
{
DataDiskType = "CLOUD_HSSD",
DataDiskSize = 50,
Encrypt = false,
},
},
Tags =
{
{ "createBy", "terraform" },
},
});
// create cvm action timer
var exampleCvmActionTimer = new Tencentcloud.CvmActionTimer("exampleCvmActionTimer", new()
{
InstanceId = exampleInstance.InstanceId,
ActionTimer = new Tencentcloud.Inputs.CvmActionTimerActionTimerArgs
{
TimerAction = "TerminateInstances",
ActionTime = "2024-11-11T11:26:40Z",
},
});
});
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.GetImagesArgs;
import com.pulumi.tencentcloud.Vpc;
import com.pulumi.tencentcloud.VpcArgs;
import com.pulumi.tencentcloud.Subnet;
import com.pulumi.tencentcloud.SubnetArgs;
import com.pulumi.tencentcloud.Instance;
import com.pulumi.tencentcloud.InstanceArgs;
import com.pulumi.tencentcloud.inputs.InstanceDataDiskArgs;
import com.pulumi.tencentcloud.CvmActionTimer;
import com.pulumi.tencentcloud.CvmActionTimerArgs;
import com.pulumi.tencentcloud.inputs.CvmActionTimerActionTimerArgs;
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 config = ctx.config();
final var availabilityZone = config.get("availabilityZone").orElse("ap-guangzhou-6");
final var images = TencentcloudFunctions.getImages(GetImagesArgs.builder()
.imageTypes("PUBLIC_IMAGE")
.imageNameRegex("TencentOS Server")
.build());
// create vpc
var vpc = new Vpc("vpc", VpcArgs.builder()
.cidrBlock("10.0.0.0/16")
.build());
// create vpc subnet
var subnet = new Subnet("subnet", SubnetArgs.builder()
.vpcId(vpc.vpcId())
.availabilityZone(availabilityZone)
.cidrBlock("10.0.20.0/28")
.isMulticast(false)
.build());
// create cvm
var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder()
.instanceName("tf_example")
.availabilityZone(availabilityZone)
.imageId(images.applyValue(getImagesResult -> getImagesResult.images()[0].imageId()))
.instanceType("SA3.MEDIUM4")
.systemDiskType("CLOUD_HSSD")
.systemDiskSize(100)
.hostname("example")
.projectId(0)
.vpcId(vpc.vpcId())
.subnetId(subnet.subnetId())
.dataDisks(InstanceDataDiskArgs.builder()
.dataDiskType("CLOUD_HSSD")
.dataDiskSize(50)
.encrypt(false)
.build())
.tags(Map.of("createBy", "terraform"))
.build());
// create cvm action timer
var exampleCvmActionTimer = new CvmActionTimer("exampleCvmActionTimer", CvmActionTimerArgs.builder()
.instanceId(exampleInstance.instanceId())
.actionTimer(CvmActionTimerActionTimerArgs.builder()
.timerAction("TerminateInstances")
.actionTime("2024-11-11T11:26:40Z")
.build())
.build());
}
}
configuration:
availabilityZone:
type: string
default: ap-guangzhou-6
resources:
# create vpc
vpc:
type: tencentcloud:Vpc
properties:
cidrBlock: 10.0.0.0/16
# create vpc subnet
subnet:
type: tencentcloud:Subnet
properties:
vpcId: ${vpc.vpcId}
availabilityZone: ${availabilityZone}
cidrBlock: 10.0.20.0/28
isMulticast: false
# create cvm
exampleInstance:
type: tencentcloud:Instance
properties:
instanceName: tf_example
availabilityZone: ${availabilityZone}
imageId: ${images.images[0].imageId}
instanceType: SA3.MEDIUM4
systemDiskType: CLOUD_HSSD
systemDiskSize: 100
hostname: example
projectId: 0
vpcId: ${vpc.vpcId}
subnetId: ${subnet.subnetId}
dataDisks:
- dataDiskType: CLOUD_HSSD
dataDiskSize: 50
encrypt: false
tags:
createBy: terraform
# create cvm action timer
exampleCvmActionTimer:
type: tencentcloud:CvmActionTimer
properties:
instanceId: ${exampleInstance.instanceId}
actionTimer:
timerAction: TerminateInstances
actionTime: 2024-11-11T11:26:40Z
variables:
images:
fn::invoke:
function: tencentcloud:getImages
arguments:
imageTypes:
- PUBLIC_IMAGE
imageNameRegex: TencentOS Server
Create CvmActionTimer Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new CvmActionTimer(name: string, args: CvmActionTimerArgs, opts?: CustomResourceOptions);
@overload
def CvmActionTimer(resource_name: str,
args: CvmActionTimerArgs,
opts: Optional[ResourceOptions] = None)
@overload
def CvmActionTimer(resource_name: str,
opts: Optional[ResourceOptions] = None,
action_timer: Optional[CvmActionTimerActionTimerArgs] = None,
instance_id: Optional[str] = None,
cvm_action_timer_id: Optional[str] = None)
func NewCvmActionTimer(ctx *Context, name string, args CvmActionTimerArgs, opts ...ResourceOption) (*CvmActionTimer, error)
public CvmActionTimer(string name, CvmActionTimerArgs args, CustomResourceOptions? opts = null)
public CvmActionTimer(String name, CvmActionTimerArgs args)
public CvmActionTimer(String name, CvmActionTimerArgs args, CustomResourceOptions options)
type: tencentcloud:CvmActionTimer
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 CvmActionTimerArgs
- 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 CvmActionTimerArgs
- 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 CvmActionTimerArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args CvmActionTimerArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args CvmActionTimerArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
CvmActionTimer 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 CvmActionTimer resource accepts the following input properties:
- Action
Timer CvmAction Timer Action Timer - Scheduled tasks. This parameter can be used to specify scheduled tasks for instances, and currently only supports scheduled destruction.
- Instance
Id string - Instance ID.
- Cvm
Action stringTimer Id - ID of the resource.
- Action
Timer CvmAction Timer Action Timer Args - Scheduled tasks. This parameter can be used to specify scheduled tasks for instances, and currently only supports scheduled destruction.
- Instance
Id string - Instance ID.
- Cvm
Action stringTimer Id - ID of the resource.
- action
Timer CvmAction Timer Action Timer - Scheduled tasks. This parameter can be used to specify scheduled tasks for instances, and currently only supports scheduled destruction.
- instance
Id String - Instance ID.
- cvm
Action StringTimer Id - ID of the resource.
- action
Timer CvmAction Timer Action Timer - Scheduled tasks. This parameter can be used to specify scheduled tasks for instances, and currently only supports scheduled destruction.
- instance
Id string - Instance ID.
- cvm
Action stringTimer Id - ID of the resource.
- action_
timer CvmAction Timer Action Timer Args - Scheduled tasks. This parameter can be used to specify scheduled tasks for instances, and currently only supports scheduled destruction.
- instance_
id str - Instance ID.
- cvm_
action_ strtimer_ id - ID of the resource.
- action
Timer Property Map - Scheduled tasks. This parameter can be used to specify scheduled tasks for instances, and currently only supports scheduled destruction.
- instance
Id String - Instance ID.
- cvm
Action StringTimer Id - ID of the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the CvmActionTimer 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 CvmActionTimer Resource
Get an existing CvmActionTimer 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?: CvmActionTimerState, opts?: CustomResourceOptions): CvmActionTimer
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
action_timer: Optional[CvmActionTimerActionTimerArgs] = None,
cvm_action_timer_id: Optional[str] = None,
instance_id: Optional[str] = None) -> CvmActionTimer
func GetCvmActionTimer(ctx *Context, name string, id IDInput, state *CvmActionTimerState, opts ...ResourceOption) (*CvmActionTimer, error)
public static CvmActionTimer Get(string name, Input<string> id, CvmActionTimerState? state, CustomResourceOptions? opts = null)
public static CvmActionTimer get(String name, Output<String> id, CvmActionTimerState state, CustomResourceOptions options)
resources: _: type: tencentcloud:CvmActionTimer 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.
- Action
Timer CvmAction Timer Action Timer - Scheduled tasks. This parameter can be used to specify scheduled tasks for instances, and currently only supports scheduled destruction.
- Cvm
Action stringTimer Id - ID of the resource.
- Instance
Id string - Instance ID.
- Action
Timer CvmAction Timer Action Timer Args - Scheduled tasks. This parameter can be used to specify scheduled tasks for instances, and currently only supports scheduled destruction.
- Cvm
Action stringTimer Id - ID of the resource.
- Instance
Id string - Instance ID.
- action
Timer CvmAction Timer Action Timer - Scheduled tasks. This parameter can be used to specify scheduled tasks for instances, and currently only supports scheduled destruction.
- cvm
Action StringTimer Id - ID of the resource.
- instance
Id String - Instance ID.
- action
Timer CvmAction Timer Action Timer - Scheduled tasks. This parameter can be used to specify scheduled tasks for instances, and currently only supports scheduled destruction.
- cvm
Action stringTimer Id - ID of the resource.
- instance
Id string - Instance ID.
- action_
timer CvmAction Timer Action Timer Args - Scheduled tasks. This parameter can be used to specify scheduled tasks for instances, and currently only supports scheduled destruction.
- cvm_
action_ strtimer_ id - ID of the resource.
- instance_
id str - Instance ID.
- action
Timer Property Map - Scheduled tasks. This parameter can be used to specify scheduled tasks for instances, and currently only supports scheduled destruction.
- cvm
Action StringTimer Id - ID of the resource.
- instance
Id String - Instance ID.
Supporting Types
CvmActionTimerActionTimer, CvmActionTimerActionTimerArgs
- Action
Time string - Execution time, expressed according to ISO8601 standard and using UTC time. The format is YYYY-MM-DDThh:mm:ssZ. For example, 2018-05-29T11:26:40Z, the execution time must be 5 minutes longer than the current time.
- Timer
Action string - Timer action, currently only supports destroying one value: TerminateInstances.
- Action
Time string - Execution time, expressed according to ISO8601 standard and using UTC time. The format is YYYY-MM-DDThh:mm:ssZ. For example, 2018-05-29T11:26:40Z, the execution time must be 5 minutes longer than the current time.
- Timer
Action string - Timer action, currently only supports destroying one value: TerminateInstances.
- action
Time String - Execution time, expressed according to ISO8601 standard and using UTC time. The format is YYYY-MM-DDThh:mm:ssZ. For example, 2018-05-29T11:26:40Z, the execution time must be 5 minutes longer than the current time.
- timer
Action String - Timer action, currently only supports destroying one value: TerminateInstances.
- action
Time string - Execution time, expressed according to ISO8601 standard and using UTC time. The format is YYYY-MM-DDThh:mm:ssZ. For example, 2018-05-29T11:26:40Z, the execution time must be 5 minutes longer than the current time.
- timer
Action string - Timer action, currently only supports destroying one value: TerminateInstances.
- action_
time str - Execution time, expressed according to ISO8601 standard and using UTC time. The format is YYYY-MM-DDThh:mm:ssZ. For example, 2018-05-29T11:26:40Z, the execution time must be 5 minutes longer than the current time.
- timer_
action str - Timer action, currently only supports destroying one value: TerminateInstances.
- action
Time String - Execution time, expressed according to ISO8601 standard and using UTC time. The format is YYYY-MM-DDThh:mm:ssZ. For example, 2018-05-29T11:26:40Z, the execution time must be 5 minutes longer than the current time.
- timer
Action String - Timer action, currently only supports destroying one value: TerminateInstances.
Package Details
- Repository
- tencentcloud tencentcloudstack/terraform-provider-tencentcloud
- License
- Notes
- This Pulumi package is based on the
tencentcloud
Terraform Provider.