-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Add full rendering for terraform resources and data sources #106
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pimielowski
commented
Jun 21, 2024
74b4505
to
b4c5f63
Compare
The codegen config.yaml has been updated to include file sections for SDK and Terraform Provider. Additional SDK imports have been added to handle resources with hashicorp/terraform-plugin-framework. Also, commenting out the code block invoking `GenerateTerraformDataSource` is part of this commit. Moreover, a new `tools.go` file has been created under the assets/provider directory.
Updated code generation for both Terraform resources and data sources. Added configuration details for the Terraform provider. Also, other minor modifications which include adding new files, file renaming, and updating imports in several files have been made as well.
Various changes were committed across multiple files to improve the code base's cleanliness and readability. Main changes included refactoring naming conventions in the 'funcs.go' file, providing clearer and more descriptive names. Moreover, an unused import in 'tfid.go' was cleaned up, and other minor reformatting actions were performed to enhance code alignment and consistency.
A TfidStruct function was added to generate tfid structures through a function in terraform_provider/template.go. This function includes both Name and Location fields in the tfid struct. Also, EncodeLocation and DecodeLocation functions were introduced in provider_internal/tools.go to handle encoding and decoding of Locationer objects. These changes pave the way for better structure generation and data handling.
The updated code improves the generation of nested struct templates and condenses redundant code in the GenerateTerraformResource function. It introduces a helper function to create nested structures for handling parameter specifications. The revised process improves code efficiency and readability.
…terraform_provider This commit adds several debugging messages to improve visibility during the nested structure handling in terraform_provider. It also refactors the handling of 'Params' and 'OneOf' attributes of the SpecParam object to reduce duplicated code and optimize operations.
This commit includes significant refactoring of the terraform provider related code for better readability and maintainability. This includes changes in the template structure, addition of utility functions and adjusting the existing functions accordingly. It also includes the introduction of unit tests for these functionalities.
Code changes extend the current functionality of the Terraform provider translation used for generating commit messages. New parameters were added mainly to handle attributes related to resource location, including device group, vsys, and shared. These changes facilitate better management of provider resources. Additional import statements were also added as required to support the new implementation. The ParamToModel function was renamed to ParamToModelBasic for clarity and consistency. A new helper function was introduced to combine two existing maps. Code was adjusted where necessary to accommodate these changes, to maintain logical consistency and coherence.
This commit improves code readability by implementing automated code formatting in the generation process. It also enhances schema descriptions by enclosing variables in backticks for clarity. Additionally, support for item length in provider parameters has been added. Several import statements were also included for newly introduced packages.
Code related to generating templates and writing to files has been refactored to improve readability and efficiency. Redundant code has been consolidated into new helper functions processTemplate and writeFormattedContentToFile, reducing complexity and improving maintainability. Comment descriptions have also been corrected for clarity and consistency.
The update involves changes in the generator code and the terraform provider to support dynamic creation of location structs for varying types. The generated struct will depend on the fields of the type passed to the generator. The code also modifies client type from `*pango.XmlApiClient` to `*pango.Client` across multiple files. This update enhances flexibility and coherence of the code.
The commit involved the removal of unused dependencies from our go.mod and go.sum files. This cleanup makes the project lighter and reduces the potential attack surface given by unused packages. It also potentially improves build times and makes dependency management simpler.
…neration This commit optimizes the code generation component for Terraform providers. Changes include injecting additional functions to handle resource creation, reading, updating, and deletion. The handling of Go types to Terraform types has been moved to a separate helper function. Code formatting has been temporarily commented out, and will be reinstated after tests.
This update refactors the execution of various code templates for readability and maintainability. It also enriches the Terraform provider file generation mechanism to better handle different resource types and specifications. Furthermore, the update ensures that the generated Go code is formatted correctly, and it fine-tunes the logic for copying assets based on the command type.
Multiple struct types are renamed and added to translate structs in the `terraform_provider` package. The changes affect the `struct.go`, `terraform_provider_file.go` and `template.go` files. Also added instructions in `README.md` file for using the provider locally. Changes also include debugging information in `terraform_provider_file.go` and function renaming/updates in several places in the code.
We are already including location via ResourceSchemaLocationAttribute function so there is no need to list it separately.
Partially done by disabling unsupported features
This replaces existing CopyFromTerraformToPango* functions.
Closed
97fa0e9
to
aea8772
Compare
e84eeeb
to
aea8772
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate)
Types of changes
Checklist