Method and device for simplifying resource IaC deployment, equipment and medium
By uniformly managing resource module templates and generating visual forms, the complexity of the operation and maintenance team in managing Git and Terraform configuration files is resolved, simplifying resource IaC deployment and improving efficiency.
Patent Information
- Application Number
- CN202510734711.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-04
- Publication Date
- 2025-09-26
AI Technical Summary
When existing enterprise operations teams use Git and Terraform to automate infrastructure deployment, they need to be familiar with complex configuration file management, which leads to high work complexity, high time cost, and the inability to unify resource version management.
Organize unified and standardized resource module templates, manage versions through Git repositories, and use JSON Schema and Formilyjs to generate visual resource information forms to simplify resource data editing and Terraform's init and plan processes.
It reduces the work difficulty of the operation and maintenance team, optimizes resource allocation, improves operation and maintenance efficiency and the reliability of resource management, and reduces time costs.
Smart Images

Figure CN120704726A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of IaC deployment technology, and in particular to a method, apparatus, device, and medium for simplifying IaC deployment of resources. Background Art
[0002] Traditional operations teams at existing enterprises use Git and Terraform to automate infrastructure deployment using CI / CD pipelines. This approach requires familiarity with Git and Terraform, and each project requires a separate set of configuration files. This makes unified resource version management impossible, and it's impossible to identify the resources required for each project. This leads to complex and time-consuming operations. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to provide a method, device, equipment and medium for simplifying resource IaC deployment, optimize the time cost and work complexity of operation and maintenance personnel, improve enterprise efficiency and reduce enterprise costs.
[0004] In a first aspect, the present invention provides a method for simplifying resource IaC deployment, comprising the following steps:
[0005] Step 1: Organize unified and standardized resource module templates for different cloud service providers and submit the organized resource module templates to the Git repository for version management;
[0006] Step 2: Obtain the corresponding version of the resource module template according to the requirements; read the version information of the resource module template and obtain the variables_schema.json file of that version;
[0007] Step 3: Read and parse the variables_schema.json file. Then, based on the defined basic attributes and corresponding form controls, process the basic attribute fields, object type fields, and array type fields to generate the final JSONSchema data. The JSON Schema data is passed to Formilyjs for rendering to generate an edit page for the visual resource information form.
[0008] Step 4: Parse the resource data submitted through the edit page, generate warehouse code based on the resource data, and trigger Terraform's init and plan;
[0009] Step 5. Record the Terraform init and plan results and provide feedback. Complete the resource IaC deployment based on the feedback.
[0010] In a second aspect, the present invention provides a device for simplifying resource IaC deployment, including:
[0011] The version management unit organizes unified and standardized resource module templates according to different cloud service providers and submits the organized resource module templates to the Git repository for version management;
[0012] Get the resource unit and obtain the corresponding version of the resource module template according to the requirements; read the version information of the resource module template and obtain the variables_schema.json file of that version;
[0013] Generate page units, read and parse the variables_schema.json file, and then process basic attribute fields, object type fields, and array type fields according to the defined basic attributes and corresponding form controls to generate the final JSON Schema data. The JSON Schema data is then passed to Formilyjs for rendering to generate an edit page for the visual resource information form.
[0014] The trigger unit parses the resource data submitted through the edit page, generates warehouse code based on the resource data, and triggers Terraform's init and plan;
[0015] The deployment unit records the Terraform init and plan results and provides feedback, completing resource IaC deployment based on the feedback.
[0016] In a third aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the program.
[0017] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the method described in the first aspect when the program is executed by a processor.
[0018] One or more technical solutions provided by the present invention have at least the following technical effects or advantages:
[0019] This invention centrally manages the resource information of each project, utilizes the existing JSON Schema technology in conjunction with Formilyjs to generate a friendly visual resource information form editing page, greatly reducing the difficulty of the operation and maintenance team's work, unifying the version management of resource modules, optimizing the previous entire set of resource configurations, improving the time cost of operation and maintenance, and making the resources deployed by the project clear at a glance, greatly facilitating the use of operation and maintenance personnel.
[0020] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are specifically listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0022] Figure 1 This is a flowchart of the method in Example 1 of the present invention;
[0023] Figure 2 This is a schematic diagram of the structure of the device in Example 2 of the present invention. DETAILED DESCRIPTION
[0024] The embodiments of the present application provide a method, apparatus, device, and medium for simplifying resource IaC deployment, thereby ensuring standardized, automated, and visualized management of resource modules, and improving operation and maintenance efficiency and the reliability of resource management.
[0025] The technical solutions in the embodiments of this application have the following general ideas:
[0026] The present invention proposes to template the resources deployed by IaC (supporting resource module configuration information deployed by Terraform), and use a program to assist in parsing and converting resource parameter information into readable data files, reading the readable data files to render the resource information content of IaC deployment, and facilitating the operation and maintenance team to quickly edit and submit through a clear interface display, and finally converting the data into the configuration file required for warehouse IaC deployment.
[0027] The specific steps include:
[0028] Step 1: Arrange resource module templates;
[0029] First, the operations team compiled resource module templates based on the unified specifications of different cloud service providers. These templates include the HCL language types, properties, and configuration files (main.tf, outputs.tf, and variables.tf) required for Terraform deployment, the output (output_template.tf.example) and module (module_template.tf.example) template files required for project resource deployment, and the repository CI / CD scripts. These resource module templates were then managed uniformly by Git to control their versions. After creating a new tag (version), the resource property file (variables.tf) was generated into the corresponding version of the JSON Schema file, variables_schema.json, using the terraschema program (https: / / github.com / HewlettPackard / terraschema) through CI / CD.
[0030] Step 2: Convert readable data;
[0031] Through the solution code program and the Git API, read the latest version of the resource module template information from all cloud service providers; read and save the latest resource attribute file variables_schema.json with the JSON Schema version for future use;
[0032] Step 3: Parse the readable resource attribute file into renderable JSON Schema data and render the form;
[0033] The front-end obtains the data of the corresponding version of the resource attribute file through the API and cooperates with Alibaba's Formilyjs to render the form. Since the obtained data is JSON data in the standard JSON Schema format, it cannot be used directly to render the form information. The data in the resource attribute file needs to be processed to ultimately generate JSON Schema data for rendering the form that Formilyjs supports.
[0034] The data in the resource attribute file only contains information such as fields, attribute types, conditions, and enumerations, but lacks some attribute information for rendering the form (x-decorator, x-component). We also need to know the attribute types, including basic attributes such as string, number, and boolean, and object attributes such as object and array. Based on the above characteristics, a recursive method is used to add form attributes to the fields.
[0035] First, define the form controls corresponding to the basic attributes;
[0036] Next, process the fields whose attribute types are basic attributes and add form attributes to them. When specifying controls, you need to first determine whether the field has an enumeration value. If so, use the select control directly. Otherwise, use the form control corresponding to the defined basic attribute.
[0037] Consider the object object and analyze its possible situations, including simple objects and dynamic key objects. Simple objects are processed directly recursively. When processing dynamic key objects, a custom component (DynamicObject) is used. The schema is still used internally to render the component. The dynamic key is divided into two parts for rendering: fixed properties (NestedPropertiesForm component, which processes fixed properties recursively) and dynamic key-value pairs (DynamicObjectFields component, which implements adding additional property keys and selecting additional property keys using property value types. Corresponding components are used according to different property value types to build a new JSON Schema). The DynamicObjectFields component is a custom component that builds the JSON Schema corresponding to the property value type based on the dynamically added key and property value type. The selected property value type may be an object, so the final JSON Schema corresponds to the component properties or DynamicObjectFields, so some components are used recursively.
[0038] Considering the array object, the array value is also divided into basic attribute types and object attribute types. When constructing an array, you must first consider the controls that include each array, uniformly use the ArrayItems control, and finally perform recursive processing based on the attribute type. When specifying the control for the basic attribute type, you must first determine whether the field has an enumeration value. If so, use the selection control (Select) directly; if not, use the form control corresponding to the defined basic attribute; for the object type, recursively process the object attributes first, build the object's JSON Schema (object's JSON), and fill the object's JSON result into the attribute of the constructed array's JSON schema. That is, when the array object includes the object type, first build the object's JSON schema (here called JsonSchema1), and then fill the result (JsonSchema1) into a certain attribute of the array object's JSON schema;
[0039] Finally, the generated new JSON Schema data is handed over to Formilyjs to render a user-friendly visual resource information form editing page, and the operation and maintenance team fills in the data and submits it;
[0040] Step 4: parse resource data to generate warehouse code;
[0041] First, the submitted resource data is parsed through the solution code program and the resource data is recorded in the database;
[0042] Then, according to the unified management plan, create a resource configuration review form to achieve resource deployment management effects. Resource configuration must be reviewed before deployment;
[0043] Next, generate important resource IaC deployment configuration files (config.yaml), resource module configuration files (modules.tf), and resource information output configuration files (outputs.tf);
[0044] Finally, create a repository branch, submit code, and request a branch merge through Git's API. After submitting the branch request, Git's CI / CD triggers the Terraform init and plan processes.
[0045] Step 5: Record the init and plan results and provide feedback to the operations team.
[0046] The execution results of Terraform's init and plan are recorded in real time and written back to the application form information. The results are fed back to the operation and maintenance team through messages and front-end page information, and then the operation and maintenance team reviews the review form.
[0047] Step 6: Process the review results, merge the warehouse branches, and complete the resource IaC deployment;
[0048] First, the audit results are obtained and handed over to the solution program to merge the warehouse branches. Git's CI / CD triggers Terraform to trigger Apply.
[0049] Next, record the results of Apply, and based on the deployment results, update the status of the review form and the resource data stored under the plan, and feed the final results back to the operation and maintenance team.
[0050] Example 1
[0051] like Figure 1 As shown, this embodiment provides a method for simplifying resource IaC deployment, including the following steps:
[0052] Step 1: Organize unified and standardized resource module templates for different cloud service providers and submit the organized resource module templates to the Git repository for version management;
[0053] Step 2: Obtain the corresponding version of the resource module template according to the requirements; read the version information of the resource module template and obtain the variables_schema.json file of that version;
[0054] Step 3: Read and parse the variables_schema.json file. Then, based on the defined basic attributes and corresponding form controls, process the basic attribute fields, object type fields, and array type fields to generate the final JSONSchema data. The JSON Schema data is passed to Formilyjs for rendering to generate an edit page for the visual resource information form.
[0055] Step 4: Parse the resource data submitted through the edit page, generate warehouse code based on the resource data, and trigger Terraform's init and plan;
[0056] Step 5. Record the Terraform init and plan results and provide feedback. Complete the resource IaC deployment based on the feedback.
[0057] In this embodiment, preferably, step 1 specifically includes: organizing unified and standardized resource module templates according to different cloud service providers, wherein the resource template templates include: HCL files required for Terraform deployment, template files required for project resource deployment, and warehouse CI / CD scripts;
[0058] Submit the organized resource module template to the Git repository for version management;
[0059] Create a new version tag and call the TerraSchema tool through the CI / CD process to convert the variables.tf file into the corresponding JSON Schema format file, namely variables_schema.json;
[0060] Include the generated variables_schema.json file and the corresponding resource module template into version management.
[0061] In this embodiment, preferably, the step 4 specifically includes: parsing the resource data submitted through the editing page and recording the resource data into the database; creating a resource configuration audit sheet based on the resource data, the audit sheet being used for auditing resource deployment;
[0062] Generated based on resource data, the IaC file includes: resource IaC deployment configuration file, resource module configuration file, and resource information output configuration file;
[0063] Use Git's API to create a new branch, commit the generated IaC file to the branch, and use Git's CI / CD process to trigger Terraform's init and plan processes.
[0064] In this embodiment, preferably, step 5 is specifically as follows: recording the execution results of Terraform's init and plan in real time, and feeding the results back to the set location, then reviewing the results, merging warehouse branches, triggering Terraform's apply operation by Git's CI / CD process, recording the results of the apply operation, and feeding them back to the set location to complete the resource IaC deployment.
[0065] Based on the same inventive concept, this application also provides a device corresponding to the method in Example 1, see Example 2 for details.
[0066] Example 2
[0067] like Figure 2 As shown, in this embodiment, a device for simplifying resource IaC deployment is provided, including:
[0068] The version management unit organizes unified and standardized resource module templates according to different cloud service providers and submits the organized resource module templates to the Git repository for version management;
[0069] Get the resource unit and obtain the corresponding version of the resource module template according to the requirements; read the version information of the resource module template and obtain the variables_schema.json file of that version;
[0070] Generate page units, read and parse the variables_schema.json file, and then process basic attribute fields, object type fields, and array type fields according to the defined basic attributes and corresponding form controls to generate the final JSON Schema data. The JSON Schema data is then passed to Formilyjs for rendering to generate an edit page for the visual resource information form.
[0071] The trigger unit parses the resource data submitted through the edit page, generates warehouse code based on the resource data, and triggers Terraform's init and plan;
[0072] The deployment unit records the Terraform init and plan results and provides feedback, completing resource IaC deployment based on the feedback.
[0073] In this embodiment, preferably, the version management unit specifically organizes unified and standardized resource module templates according to different cloud service providers, and the resource template templates include: HCL files required for Terraform deployment, template files required for project resource deployment, and warehouse CI / CD scripts;
[0074] Submit the organized resource module template to the Git repository for version management;
[0075] Create a new version tag and call the TerraSchema tool through the CI / CD process to convert the variables.tf file into the corresponding JSON Schema format file, namely variables_schema.json;
[0076] Include the generated variables_schema.json file and the corresponding resource module template into version management.
[0077] In this embodiment, preferably, the trigger unit specifically: parses the resource data submitted through the edit page and records the resource data into a database; creates a resource configuration audit sheet based on the resource data, the audit sheet being used for auditing resource deployment;
[0078] Generated based on resource data, the IaC file includes: resource IaC deployment configuration file, resource module configuration file, and resource information output configuration file;
[0079] Use Git's API to create a new branch, commit the generated IaC file to the branch, and use Git's CI / CD process to trigger Terraform's init and plan processes.
[0080] In this embodiment, preferably, the deployment unit specifically records the execution results of Terraform's init and plan in real time, and feeds back the results to a set location, then reviews the results, merges warehouse branches, triggers Terraform's apply operation by Git's CI / CD process, records the results of the apply operation, feeds back to the set location, and completes the resource IaC deployment.
[0081] Since the device described in the second embodiment of the present invention is used to implement the method of the first embodiment of the present invention, those skilled in the art will be able to understand the specific structure and variations of the device based on the method described in the first embodiment of the present invention, and therefore will not be described in detail here. All devices used in the method of the first embodiment of the present invention fall within the scope of protection of the present invention.
[0082] Based on the same inventive concept, this application provides an electronic device embodiment corresponding to the first embodiment, see the third embodiment for details.
[0083] Example 3
[0084] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, any implementation method in the first embodiment can be implemented.
[0085] Since the electronic device described in this embodiment is the device used to implement the method in Example 1 of this application, based on the method described in Example 1 of this application, those skilled in the art will be able to understand the specific implementation of the electronic device of this embodiment and its various variations. Therefore, how the electronic device implements the method in the embodiment of this application will not be described in detail here. As long as the device used by those skilled in the art to implement the method in the embodiment of this application falls within the scope of protection to be provided by this application.
[0086] Based on the same inventive concept, this application provides a storage medium corresponding to Example 1, see Example 4 for details.
[0087] Example 4
[0088] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, any implementation method in the first embodiment can be implemented.
[0089] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0090] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1A device that provides the functions specified in a block or multiple blocks.
[0091] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0092] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.
[0093] Although the specific embodiments of the present invention are described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included within the scope of protection of the claims of the present invention.
Claims
1. A method for simplifying resource IaC deployment, characterized by: The steps include: Step 1: Organize unified and standardized resource module templates for different cloud service providers and submit the organized resource module templates to the Git repository for version management; Step 2: Obtain the corresponding version of the resource module template according to the requirements; read the version information of the resource module template and obtain the variables_schema.json file of that version; Step 3: Read and parse the variables_schema.json file. Then, based on the defined basic attributes and corresponding form controls, process the basic attribute fields, object type fields, and array type fields to generate the final JSON Schema data. The JSON Schema data is then passed to Formilyjs for rendering to generate an edit page for the visual resource information form. Step 4: Parse the resource data submitted through the edit page, generate warehouse code based on the resource data, and trigger Terraform's init and plan; Step 5. Record the Terraform init and plan results and provide feedback. Complete the resource IaC deployment based on the feedback.
2. The method for simplifying resource IaC deployment according to claim 1, characterized in that: Step 1 specifically includes: organizing unified and standardized resource module templates according to different cloud service providers, wherein the resource template templates include: HCL files required for Terraform deployment, template files required for project resource deployment, and warehouse CI / CD scripts; Submit the organized resource module template to the Git repository for version management; Create a new version tag and call the TerraSchema tool through the CI / CD process to convert the variables.tf file into the corresponding JSON Schema format file, namely variables_schema.json; Include the generated variables_schema.json file and the corresponding resource module template into version management.
3. The method for simplifying resource IaC deployment according to claim 1, characterized in that: The step 4 specifically includes: parsing the resource data submitted through the editing page and recording the resource data into the database; Creating a resource configuration audit sheet based on resource data, the audit sheet is used for auditing resource deployment; Generated based on resource data, the IaC file includes: resource IaC deployment configuration file, resource module configuration file, and resource information output configuration file; Use Git's API to create a new branch, commit the generated IaC file to the branch, and use Git's CI / CD process to trigger Terraform's init and plan processes.
4. The method for simplifying resource IaC deployment according to claim 1, characterized in that: Step 5 specifically includes: recording the execution results of Terraform's init and plan in real time, and feeding the results back to the set location, then reviewing the results, merging warehouse branches, triggering Terraform's apply operation by Git's CI / CD process, recording the results of the apply operation, and feeding them back to the set location to complete the resource IaC deployment.
5. A device for simplifying resource IaC deployment, characterized by: include: The version management unit organizes unified and standardized resource module templates according to different cloud service providers and submits the organized resource module templates to the Git repository for version management; Get the resource unit and obtain the corresponding version of the resource module template according to the requirements; Read the version information of the resource module template and obtain the variables_schema.json file of that version; Generate page units, read and parse the variables_schema.json file, and then process basic attribute fields, object type fields, and array type fields according to the defined basic attributes and corresponding form controls to generate the final JSONSchema data. The JSON Schema data is then passed to Formilyjs for rendering to generate an edit page for the visual resource information form. The trigger unit parses the resource data submitted through the edit page, generates warehouse code based on the resource data, and triggers Terraform's init and plan; The deployment unit records the Terraform init and plan results and provides feedback, completing resource IaC deployment based on the feedback.
6. The device for simplifying resource IaC deployment according to claim 5, characterized in that: The version management unit specifically organizes standardized resource module templates according to different cloud service providers. The resource template templates include: HCL files required for Terraform deployment, template files required for project resource deployment, and warehouse CI / CD scripts; Submit the organized resource module template to the Git repository for version management; Create a new version tag and call the TerraSchema tool through the CI / CD process to convert the variables.tf file into the corresponding JSON Schema format file, namely variables_schema.json; Include the generated variables_schema.json file and the corresponding resource module template into version management.
7. The device for simplifying resource IaC deployment according to claim 5, characterized in that: The trigger unit specifically: parses the resource data submitted through the edit page and records the resource data into the database; Creating a resource configuration audit sheet based on resource data, the audit sheet is used for auditing resource deployment; Generated based on resource data, the IaC file includes: resource IaC deployment configuration file, resource module configuration file, and resource information output configuration file; Use Git's API to create a new branch, commit the generated IaC file to the branch, and use Git's CI / CD process to trigger Terraform's init and plan processes.
8. The device for simplifying resource IaC deployment according to claim 5, characterized in that: The deployment unit specifically records the execution results of Terraform's init and plan in real time, and feeds the results back to the set location. It then reviews the results, merges warehouse branches, and triggers Terraform's apply operation through Git's CI / CD process. The results of the apply operation are recorded and fed back to the set location to complete the resource IaC deployment.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method according to any one of claims 1 to 4 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.