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
import { Construct } from "constructs";
import { TerraformOutput, TerraformStack } from "cdktf";
/*
 * Provider bindings are generated by running `cdktf get`.
 * See https://cdk.tf/provider-generation for more details.
 */
import { StaticResource } from "./.gen/providers/time/static-resource";
class MyConvertedCode extends TerraformStack {
  constructor(scope: Construct, name: string) {
    super(scope, name);
    const example = new StaticResource(this, "example", {});
    new TerraformOutput(this, "current_time", {
      value: example.rfc3339,
    });
  }
}

Triggers Usage

// DO NOT EDIT. Code generated by 'cdktf convert' - Please report bugs at https://cdk.tf/bug
import { Construct } from "constructs";
import { Token, Fn, TerraformStack } from "cdktf";
/*
 * Provider bindings are generated by running `cdktf get`.
 * See https://cdk.tf/provider-generation for more details.
 */
import { Instance } from "./.gen/providers/aws/instance";
import { StaticResource } from "./.gen/providers/time/static-resource";
class MyConvertedCode extends TerraformStack {
  constructor(scope: Construct, name: string) {
    super(scope, name);
    const amiUpdate = new StaticResource(this, "ami_update", {
      triggers: {
        ami_id: Token.asString(example.id),
      },
    });
    new Instance(this, "server", {
      ami: Token.asString(Fn.lookupNested(amiUpdate, ["triggers", "ami_id"])),
      tags: {
        AmiUpdateTime: amiUpdate.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.