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
from constructs import Construct
from cdktf import Token, Fn, TerraformStack
#
# Provider bindings are generated by running `cdktf get`.
# See https://cdk.tf/provider-generation for more details.
#
from imports.aws.instance import Instance
from imports.time.static_resource import StaticResource
class MyConvertedCode(TerraformStack):
def __init__(self, scope, name):
super().__init__(scope, name)
ami_update = StaticResource(self, "ami_update",
triggers={
"ami_id": Token.as_string(example.id)
}
)
Instance(self, "server",
ami=Token.as_string(Fn.lookup_nested(ami_update, ["triggers", "ami_id"])),
tags={
"AmiUpdateTime": ami_update.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.