blob: 4b0bde4066f9973e087e3377ae3d4cf1aaba1d4a [file] [log] [blame] [view]
---
page_title: "Provider: Time"
description: |-
The time provider is used to interact with time-based resources.
---
<!-- Please do not edit this file, it is generated. -->
# Time Provider
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.
## Resource "Triggers"
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:
```python
# 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](https://www.terraform.io/docs/commands/taint.html) can be used to produce the action on the next run.
<!-- cache-key: cdktf-0.19.0 input-bc12960a9acfa8c6ebb6834f5fc7a95b4cc9baf2b76cbb71ea47c692591f4c4f 556251879b8ed0dc4c87a76b568667e0ab5e2c46efdd14a05c556daf05678783-->