This topic describes the common commands that you can run to convert different types of templates to Resource Orchestration Service (ROS) templates by using Template Transformer.

View help information

Run the following command to view the help information about Template Transformer:

rostran --help

Convert a template

Run the following command to convert a template:

rostran transform SOURCE_PATH [OPTIONS]

The following table describes the parameters in the command.

Parameter Required Description
SOURCE_PATH Yes The path in which the original template is stored. The original template can be an Excel, Terraform, or AWS CloudFormation template.
OPTIONS No Valid values:
  • --source-format: the format of the original template. The template format varies based on the suffix of the SOURCE_PATH value. Default value: auto. Valid values:
    • auto
    • terraform
    • excel
    • cloudformation

    For example, you can run the following command to convert a Terraform template to an ROS template. In the command, --source-format terraform specifies that the original template is a Terraform template. The original template is named main.tf.

    rostran transform templates/terraform/alicloud --source-format terraform
  • --target-path: the path of the ROS template file. By default, the value of this parameter is the directory in which the original template is stored. Valid values:
    • A specific directory: the directory of the ROS template file named template.
    • A specific path: the path of the ROS template file named template. The ROS template file must be in the JSON or YAML format.
  • --target-format: the format of the ROS template file. Default value: auto. Valid values:
    • auto
      Note If you set --target-path to a specific path, the --target-format value is the same as the format of the file that is stored in the path. If you set --target-path to a specific directory, the name of the ROS template file is template.yml.
    • json
    • yaml

    For example, you can run the following command to convert a Terraform template to an ROS template and generate a JSON template file named template.json in the directory in which the original template file is stored.

    rostran transform templates/terraform/alicloud/main.tf --target-format json

For more information about how to convert different types of templates to ROS templates, see the following references: