The time provider is used to interact with time-based resources. The provider itself has no configuration options.
Use the navigation to the left to read about the available resources.
Certain time resources, only perform actions during specific lifecycle actions:
time_offset
: Saves base timestamp into Terraform state only when created.time_sleep
: Sleeps when created and/or destroyed.time_static
: Saves base timestamp into Terraform state only when created.These resources provide an optional map argument called triggers
that can be populated with arbitrary key/value pairs. When the keys or values of this argument are updated, Terraform will re-perform the desired action, such as updating the base timestamp or sleeping again.
For example:
// DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug
import { Construct } from "constructs";
import { Token, Fn, TerraformStack } from "cdktf";
/*
* Provider bindings are generated by running `cdktf get`.
* See https://cdk.tf/provider-generation for more details.
*/
import { Instance } from "./.gen/providers/aws/instance";
import { StaticResource } from "./.gen/providers/time/static-resource";
class MyConvertedCode extends TerraformStack {
constructor(scope: Construct, name: string) {
super(scope, name);
const amiUpdate = new StaticResource(this, "ami_update", {
triggers: {
ami_id: Token.asString(example.id),
},
});
new Instance(this, "server", {
ami: Token.asString(Fn.lookupNested(amiUpdate, ["triggers", "ami_id"])),
tags: {
AmiUpdateTime: amiUpdate.rfc3339,
},
});
}
}
triggers
are not treated as sensitive attributes; a value used for triggers
will be displayed in Terraform UI output as plaintext.
To force a these actions to reoccur without updating triggers
, the terraform taint
command can be used to produce the action on the next run.