Skip to content

hcl2cdk: convert top-level ephemeral {} blocks #310

Description

@so0k

Follow-up from #296 (tracked in the PR body as "hcl2cdk conversion of ephemeral {} blocks — tracked, not built").

Why

#296 generates TerraformEphemeralResource bindings and synthesizes top-level ephemeral {} blocks, but the convert direction is missing: cdktn convert silently drops ephemeral blocks from input HCL. packages/@cdktn/hcl2cdk/src/schema.ts defines the accepted input via a non-passthrough zod object; unknown top-level keys (including ephemeral) are stripped before conversion logic runs, with no warning.

What

cdktn convert should turn ephemeral "random_password" "pw" { ... } into new EphemeralRandomPassword(...) referencing the generated bindings, exactly parallel to resource/data-source conversion.

How (implementation notes)

  • schema.ts: add ephemeral top-level key (same shape as resource).
  • Conversion path: mirror the data-source mapping with the ephemeral_ type prefix used by the generator (class names Ephemeral<PascalType>, namespace folders ephemeral-<kebab-type>/) — the prefix conventions were fixed in feat: support newer provider plugin-protocol features via targetVersions (RFC-04) #296's provider-generator commit.
  • References: ephemeral.<type>.<name>.<attr> expressions must resolve to the construct's attribute accessors.
  • Consider emitting a conversion warning for any other silently-dropped top-level key while in there (moved/check/removed share the same silent-strip behavior).

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions