Skip to content

cdktn: TerraformOutput precondition is accepted but never synthesized #448

Description

@so0k

Expected Behavior

TerraformOutput accepts a typed precondition (TerraformOutputConfig.precondition), so it should synthesize an output precondition block (JSON and HCL).

Actual Behavior

The property is stored and then silently dropped — no precondition in the synthesized output, no warning.

packages/cdktn/src/terraform-output.ts declares it (:26), keeps it (:35, :45), but neither synthesizeAttributes() (:99-106) nor synthesizeHclAttributes() (:108-137) emits it, and nothing else reads .precondition.

Steps to Reproduce

const env = new TerraformVariable(stack, "env", { type: "string" });
new TerraformOutput(stack, "out", {
  value: env.stringValue,
  precondition: { condition: Op.neq(env.stringValue, ""), errorMessage: "env must not be empty." },
});
// Testing.synth(stack) -> "out": { "value": "${var.env}" }   (no precondition; same with synthHcl)

Workaround

output.addOverride("precondition", [{ condition: "${...}", error_message: "..." }])

Anything Else?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions