Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform Resource Schema Traversal shared for multiple pipelines #9

Closed
ulucinar opened this issue Jun 9, 2022 · 0 comments · Fixed by #46
Closed

Terraform Resource Schema Traversal shared for multiple pipelines #9

ulucinar opened this issue Jun 9, 2022 · 0 comments · Fixed by #46
Assignees
Labels
enhancement New feature or request

Comments

@ulucinar
Copy link
Collaborator

ulucinar commented Jun 9, 2022

What problem are you facing?

For multiple code generation pipelines of upjet, we need to traverse the Terraform resource schema to extract information about the resources (to calculate field names, to generate references, etc.). The main site that does this object (schema) traversal as of now is the CRD generator pipeline's types.buildResource function. However, for generating example manifests with the pipeline being introduced with #4, we also need to extract information from the same object structure (schema). In #4, we have cached the information needed for the example generation pipeline with types.Transformation objects while traversing the schema for CRD generation, to further utilize it in the new pipeline being introduced.

Currently for implementing new pipelines, we need to either duplicate the schema traversal logic, or as stated above, cache the needed information extracted from an existing pipeline to utilize it in a new pipeline.

How could Terrajet help solve your problem?

We may consider implementing a pattern like the visitor pattern to abstract the schema object traversal from the pipeline implementation itself. This would allow us to share the recursive traversal logic currently implemented in types.buildResource and types.buildSchema functions between the pipelines by abstracting the schema traversal logic from the pipeline traversal logic.

@ulucinar ulucinar added the enhancement New feature or request label Jun 9, 2022
@ulucinar ulucinar changed the title Terraform Resource Schema Traversal Terraform Resource Schema Traversal shared for multiple pipelines Jun 9, 2022
@muvaf muvaf self-assigned this Jun 20, 2022
@muvaf muvaf closed this as completed in #46 Aug 9, 2022
sergenyalcin pushed a commit to sergenyalcin/upjet that referenced this issue Nov 13, 2023
ulucinar pushed a commit that referenced this issue Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants