time_static (Resource)

Manages a static time resource, which keeps a locally sourced UTC timestamp stored in the Terraform state. This prevents perpetual differences caused by using the timestamp() function.

Example Usage

Basic Usage

# DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug
from constructs import Construct
from cdktf import TerraformOutput, TerraformStack
#
# Provider bindings are generated by running `cdktf get`.
# See https://cdk.tf/provider-generation for more details.
#
from imports.time.static_resource import StaticResource
class MyConvertedCode(TerraformStack):
    def __init__(self, scope, name):
        super().__init__(scope, name)
        example = StaticResource(self, "example")
        TerraformOutput(self, "current_time",
            value=example.rfc3339
        )

Triggers Usage

# 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
            }
        )

Schema

Optional

Read-Only

Import

This resource can be imported using the UTC RFC3339 value, e.g.

terraform import time_static.example 2020-02-12T06:36:13Z

The triggers argument cannot be imported.