github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/website/docs/language/functions/plantimestamp.mdx (about) 1 --- 2 page_title: plantimestamp - Functions - Configuration Language 3 description: |- 4 The plantimestamp functions a string representation of the date and time 5 during the plan. 6 --- 7 8 # `plantimestamp` Function 9 10 -> **Note:** This function is only available in Terraform v1.5 and later. 11 12 `plantimestamp` returns a UTC timestamp string in [RFC 3339](https://tools.ietf.org/html/rfc3339) format. 13 14 In the Terraform language, timestamps are conventionally represented as 15 strings using [RFC 3339](https://tools.ietf.org/html/rfc3339) 16 "Date and Time format" syntax, and so `plantimestamp` returns a string 17 in this format. 18 19 The result of this function will change for every plan operation. It is intended 20 for use within [Custom Conditions](/terraform/language/expressions/custom-conditions) 21 as a way to validate time sensitive resources such as TLS certificates. 22 23 There are circumstances, such as during a Terraform [Refresh-only](/terraform/cli/commands/plan#planning-modes) plan, where 24 the value for this function will be recomputed but not propagated to resources 25 defined within the configuration. As such, it is recommended that this function 26 only be used to compare against timestamps exported by providers and not against 27 timestamps generated in the configuration. 28 29 The `plantimestamp` function is not available within the Terraform console. 30 31 ## Examples 32 33 ``` 34 > plantimestamp() 35 2018-05-13T07:44:12Z 36 ``` 37 38 ```terraform 39 check "terraform_io_certificate" { 40 data "tls_certificate" "terraform_io" { 41 url = "https://www.terraform.io/" 42 } 43 44 assert { 45 condition = timecmp(plantimestamp(), data.tls_certificate.terraform_io.certificates[0].not_after) < 0 46 error_message = "terraform.io certificate has expired" 47 } 48 } 49 ``` 50 51 ## Related Functions 52 53 * [`timestamp`](/terraform/language/functions/timestamp) returns the current timestamp when it is evaluated 54 during the apply step.