Skip to content

Codegen: properly handle terraformConfig types from Terraform Module Provider support #592

@lbialy

Description

@lbialy

Problem

Pulumi added Terraform Module Provider support which introduces terraformConfig entries in provider schemas:

  • A method on the provider resource: "terraformConfig": "pulumi:providers:<pkg>/terraformConfig"
  • A function in the functions section: "pulumi:providers:<pkg>/terraformConfig"
  • The function's inputs has type: "pulumi:providers:<pkg>/terraformConfig" (a type token, not "object")

These cause multiple issues in besom's codegen:

  1. The function generates ProviderArgs.scala which conflicts with the existing provider args file
  2. The type field containing a type token crashes ObjectTypeDefinition deserialization (see Codegen: type token in ObjectTypeDefinition crashes schema deserialization #591)

Current workaround

  • Method filtered out by name match: filterNot { case (name, _) => name == "terraformConfig" } (pre-existing)
  • Function filtered out by token match: filterNot { case (token, _) => token.endsWith("/terraformConfig") } (new)
  • ObjectTypeDefinition returns empty for unrecognized type values with a warning (new)

Follow-up needed

We should investigate whether besom should support Terraform Module Provider wrapping. If so, terraformConfig needs proper codegen support rather than being filtered out. If not, the current filters are sufficient but should be documented.

Affected schemas include tls (5.2.3+) and likely aws and other providers.

Location

  • codegen/src/PulumiPackageInfo.scalaparseMethods (line 46) and parseFunctions (line 121)
  • codegen/src/PulumiPackage.scalaObjectTypeDefinitionProtoLike.maybeAsObjectTypeDefinition

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/codegenSchema to code generator

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions