Question arising from my <new PR>. Would be happy ...
# contribute
s
Question arising from my new PR. Would be happy if you could give me directions for this 🙂 : 1. I’ve seen the 
PolicyStatement
 interface & others are generated code. In that PR #232 it isn’t mentioned how the code-generation was done. My guess it’s generated from TF’s datasource `aws_iam_policy_document`. Is that correct? Is this procedure documented? 2. If it’s based from these datasource: Would it make sense to add an 
ExactlyOneOf
  there (currently it’s just 
"actions": setOfString
)? Or ... 3. Is there an equivalent setting for 
ExactlyOneOf
 in Typescript or Pulumi’s API?
Please @mention me here that I get a notification for faster feedback.
w
I’ve seen the 
PolicyStatement
 interface & others are generated code.
That particular interface is not generated currently - it is manually authored. You can see that there is no "auto-generated" header on https://github.com/pulumi/pulumi-aws/blob/27eaaaab8a4b431ec9dfe720f029189916b13dab/sdk/nodejs/iam/documents.ts. We are hoping to auto-generate it soon - mostly so that we can get the benefit of that strongly typed policy statement input in all languages - not just TypeScript. This is tracked in https://github.com/pulumi/pulumi-terraform-bridge/issues/132. Once that is done, these would be auto-generated. More broadly - we are half way through moving all of the code-generation for SDKs over to a single unified schema-based code generator. There is a single Pulumi schema for each package, that is used to represent all the pulumi resources, functions and types in the package, and that is used as the source for generating language-specific SDKs and docs. You can see https://github.com/pulumi/pulumi/blob/master/pkg/codegen/schema/schema.go for raw details. I expect we'll write up some more content on this schema once we get through the initial migration..
s
Oh, thanks for the quick & thorough answer 👍 I see. If there’s no
Copy code
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
header, we can assume that it is manually authored. Yeah, I also wondered how do you (automatically) transfer changes in a PR from one language to another. So, it seems like you’re heading to sth. similar like GCP's magic-modules, right?
w
Yeah - there's some similarity to magic modules. In practice our generator could one-day be another layer in front of magic-modules (we've talked to the team at Google about this). In the same way - for our Terraform-based providers we currently lower them from the Terraform schema to the Pulumi schema and from there into individual Pulumi language SDKs. For the GCP provider this ultimately looks like Magic Modules -> Terraform Schema -> Pulumi Schema -> TypeScript. We could imagine dropping the Terraform Schema step in there in the future and integrating directly into Magic Modules.