Template Management
Walrus provides the following two levels of templates:
- Project Template: Applied to a specific project, project templates can be used within the current project.
- Global Template: A template that can be applied to all projects, global templates can be used across all projects.
View Template List
- The template list includes all templates from catalogs as well as independently added templates.
- Navigate to the template list page.
- Project Template: Click on the
Applicationsmenu in the left navigation bar and go to a project's view, then click theTemplatestab. - Global Template: Click on the
Operationsmenu in the navigation bar and go to theTemplatestab.
- Project Template: Click on the
Add Template
Navigate to the template list page.
- Project Template: Click on the
Applicationsmenu in the left navigation bar and go to a project's view, then click theTemplatestab. - Global Template: Click on the
Operationsmenu in the navigation bar and click to theTemplatestab.
- Project Template: Click on the
Click the
New Templatebutton.Enter the template's name, description, and source. The template source is an address compatible with Terraform git module source, for details please refer to the documentation. Here are some examples:
- https://github.com/walrus-catalog/webservice?ref=v0.0.1
- https://github.com/walrus-catalog/webservice?ref=main
- https://github.com/seal-io/walrus-template-template//modules/submodule?ref=main
Hints: You can specify a version using the
refparameter, and the specified version must be a tag or branch that exists in the git repository. You can import templates from subdirectories by appending a subdirectory path after the repository URL.Click the
Confirmbutton.
Edit Template
- Enter the
Templatestab.- Project Template: Click on
Applicationsin the navigation bar and go to a project's view, then click on theTemplatestab. - Global Template: Click on
Operationsin the navigation bar and enter theTemplatestab.
- Project Template: Click on
- Find the template you need to edit.
- Click the more operations button indicated by the thumbnail and select
edit. - Modify the corresponding attribute values as per your need.
- Click the
Savebutton.
Note: You can only edit a template that is not imported from a catalog.
Deleting Template
- Enter the
Templatestab.- Project Template: Click on
Applicationsin the navigation bar and go to a project's view, then click theTemplatestab. - Global Template: Click on
Operationsin the navigation bar and enter theTemplatestab.
- Project Template: Click on
- Select the template you need to delete.
- Click the "Delete" button.
- In the delete confirmation prompt, click the
Deletebutton.
Edit Template UI Schema
- Navigate to the template list page.
- Project Template: Click on the
Applicationsmenu in the left navigation bar and go to a project's view, then click theTemplatestab. - Global Template: Click on the
Operationsmenu in the navigation bar and go to theTemplatestab.
- Project Template: Click on the
- Find the template for which you want to edit the UI schema.
- Click on the template name to enter the details page. In the details page, select
UI Schema. - Click the
Editbutton, and modify the corresponding UI schema as needed. ClickPreviewto see the effects. - Click the
Savebutton.
AI-assisted Template Creation
Walrus can use OpenAI's GPT large language model capabilities to assist you in writing and submitting templates.
Note: Before using this feature, you first need to:
- Obtain OpenAI's API token and configure it in Walrus's system settings.
- Create a version control connector.
Generating Templates Based on Natural Language Descriptions
- Click on
Operationsin the navigation bar and enter theTemplatestab. - Click the `AI Write Template`` button.
- In the text box, use natural language to describe the functionality of the template you need. You can select an example from the instance list in the top right corner.
- Click the
Generatebutton.
Explaining the Functionality of Template Code
- Click on
Operationsin the navigation bar and enter theTemplatestab. - Click the
AI Write Templatebutton. - After generating/writing the template code in the text box via AI, click the "Explain" button.
- Click the
OKbutton to close the template explanation popup.
Correcting Template Code
- Click on
Operationsin the navigation bar and enter theTemplatestab. - Click the
AI Write Templatebutton. - After generating/writing the template code in the text box via AI, click the
Correctbutton. - Review the repair instructions and consider the suggested repairs.
- Click
Accept Repairin the top left corner to apply the repair suggestion, or "Abort Repair" to discard the repair suggestion.
Submitting Written Template Code to Git Repository
- Click on
Operationsin the navigation bar and enter theTemplatestab. - After generating/writing the template code in the text box via AI, click the
Create PRbutton. - Select an available version control connector.
- Select a code repository.
- Select the target branch.
- Enter the submission path, that is, the folder path in the code repository where this template is stored.
- Click the
Savebutton.