Resource: awsRedshiftScheduledAction
Example Usage
Pause Cluster Action
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const dataAwsIamPolicyDocumentAssumeRole =
new aws.dataAwsIamPolicyDocument.DataAwsIamPolicyDocument(
this,
"assume_role",
{
statement: [
{
actions: ["sts:AssumeRole"],
effect: "Allow",
principals: [
{
identifiers: ["scheduler.redshift.amazonaws.com"],
type: "Service",
},
],
},
],
}
);
const dataAwsIamPolicyDocumentExample =
new aws.dataAwsIamPolicyDocument.DataAwsIamPolicyDocument(this, "example", {
statement: [
{
actions: [
"redshift:PauseCluster",
"redshift:ResumeCluster",
"redshift:ResizeCluster",
],
effect: "Allow",
resources: ["*"],
},
],
});
const awsIamPolicyExample = new aws.iamPolicy.IamPolicy(this, "example_2", {
name: "redshift_scheduled_action",
policy: dataAwsIamPolicyDocumentExample.json,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsIamPolicyExample.overrideLogicalId("example");
const awsIamRoleExample = new aws.iamRole.IamRole(this, "example_3", {
assumeRolePolicy: dataAwsIamPolicyDocumentAssumeRole.json,
name: "redshift_scheduled_action",
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsIamRoleExample.overrideLogicalId("example");
const awsIamRolePolicyAttachmentExample =
new aws.iamRolePolicyAttachment.IamRolePolicyAttachment(this, "example_4", {
policyArn: awsIamPolicyExample.arn,
role: awsIamRoleExample.name,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsIamRolePolicyAttachmentExample.overrideLogicalId("example");
const awsRedshiftScheduledActionExample =
new aws.redshiftScheduledAction.RedshiftScheduledAction(this, "example_5", {
iamRole: awsIamRoleExample.arn,
name: "tf-redshift-scheduled-action",
schedule: "cron(00 23 * * ? *)",
targetAction: {
pauseCluster: {
clusterIdentifier: "tf-redshift001",
},
},
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsRedshiftScheduledActionExample.overrideLogicalId("example");
Resize Cluster Action
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.redshiftScheduledAction.RedshiftScheduledAction(this, "example", {
iamRole: "${aws_iam_role.example.arn}",
name: "tf-redshift-scheduled-action",
schedule: "cron(00 23 * * ? *)",
targetAction: {
resizeCluster: {
clusterIdentifier: "tf-redshift001",
clusterType: "multi-node",
nodeType: "dc1.large",
numberOfNodes: 2,
},
},
});
Argument Reference
The following arguments are supported:
name
- (Required) The scheduled action name.description
- (Optional) The description of the scheduled action.enable
- (Optional) Whether to enable the scheduled action. Default istrue
.startTime
- (Optional) The start time in UTC when the schedule is active, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ).endTime
- (Optional) The end time in UTC when the schedule is active, in UTC RFC3339 format(for example, YYYY-MM-DDTHH:MM:SSZ).schedule
- (Required) The schedule of action. The schedule is defined format of "at expression" or "cron expression", for exampleat(20160304T17:27:00)
orcron(010 ? *Mon *)
. See Scheduled Action for more information.iamRole
- (Required) The IAM role to assume to run the scheduled action.targetAction
- (Required) Target action. Documented below.
Nested Blocks
targetAction
pauseCluster
- (Optional) An action that runs apauseCluster
API operation. Documented below.resizeCluster
- (Optional) An action that runs aresizeCluster
API operation. Documented below.resumeCluster
- (Optional) An action that runs aresumeCluster
API operation. Documented below.
pauseCluster
clusterIdentifier
- (Required) The identifier of the cluster to be paused.
resizeCluster
clusterIdentifier
- (Required) The unique identifier for the cluster to resize.classic
- (Optional) A boolean value indicating whether the resize operation is using the classic resize process. Default:false
.clusterType
- (Optional) The new cluster type for the specified cluster.nodeType
- (Optional) The new node type for the nodes you are adding.numberOfNodes
- (Optional) The new number of nodes for the cluster.
resumeCluster
clusterIdentifier
- (Required) The identifier of the cluster to be resumed.
Attributes Reference
In addition to all arguments above, the following attributes are exported:
id
- The Redshift Scheduled Action name.
Import
Redshift Scheduled Action can be imported using the name
, e.g.,