time_offset (Resource)

Manages an offset time resource, which keeps an UTC timestamp stored in the Terraform state that is offset from a locally sourced base timestamp. 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.offset import Offset
class MyConvertedCode(TerraformStack):
    def __init__(self, scope, name):
        super().__init__(scope, name)
        example = Offset(self, "example",
            offset_days=7
        )
        TerraformOutput(self, "one_week_from_now",
            value=example.rfc3339
        )

Multiple Offsets 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.offset import Offset
class MyConvertedCode(TerraformStack):
    def __init__(self, scope, name):
        super().__init__(scope, name)
        example = Offset(self, "example",
            offset_months=1,
            offset_years=1
        )
        TerraformOutput(self, "one_year_and_month_from_now",
            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.offset import Offset
class MyConvertedCode(TerraformStack):
    def __init__(self, scope, name):
        super().__init__(scope, name)
        ami_update = Offset(self, "ami_update",
            offset_days=7,
            triggers={
                "ami_id": Token.as_string(example.id)
            }
        )
        Instance(self, "server",
            ami=Token.as_string(Fn.lookup_nested(ami_update, ["triggers", "ami_id"])),
            tags={
                "ExpirationTime": ami_update.rfc3339
            }
        )

Schema

Optional

Read-Only

Import

This resource can be imported using the base UTC RFC3339 timestamp and offset years, months, days, hours, minutes, and seconds, separated by commas (,), e.g.

terraform import time_offset.example 2020-02-12T06:36:13Z,0,0,7,0,0,0

The triggers argument cannot be imported.