62 lines
2.9 KiB
Markdown
62 lines
2.9 KiB
Markdown
---
|
|
title: vela def init
|
|
---
|
|
|
|
Init a new definition
|
|
|
|
### Synopsis
|
|
|
|
Init a new definition with given arguments or interactively
|
|
* We support parsing a single YAML file (like kubernetes objects) into the cue-style template.
|
|
However, we do not support variables in YAML file currently, which prevents users from directly feeding files like helm chart directly.
|
|
We may introduce such features in the future.
|
|
|
|
```
|
|
vela def init DEF_NAME [flags]
|
|
```
|
|
|
|
### Examples
|
|
|
|
```
|
|
# Command below initiate an empty TraitDefinition named my-ingress
|
|
> vela def init my-ingress -t trait --desc "My ingress trait definition." > ./my-ingress.cue
|
|
# Command below initiate a definition named my-def interactively and save it to ./my-def.cue
|
|
> vela def init my-def -i --output ./my-def.cue
|
|
# Command below initiate a ComponentDefinition named my-webservice with the template parsed from ./template.yaml.
|
|
> vela def init my-webservice -i --template-yaml ./template.yaml
|
|
# Initiate a Terraform ComponentDefinition named vswitch from Github for Alibaba Cloud.
|
|
> vela def init vswitch --type component --provider alibaba --desc xxx --git https://github.com/kubevela-contrib/terraform-modules.git --path alibaba/vswitch
|
|
# Initiate a Terraform ComponentDefinition named redis from local file for AWS.
|
|
> vela def init redis --type component --provider aws --desc "Terraform configuration for AWS Redis" --local redis.tf
|
|
```
|
|
|
|
### Options
|
|
|
|
```
|
|
-d, --desc string Specify the description of the new definition.
|
|
--git string Specify which git repository the configuration(HCL) is stored in. Valid when --provider/-p is set.
|
|
-h, --help help for init
|
|
-i, --interactive Specify whether use interactive process to help generate definitions.
|
|
--local string Specify the local path of the configuration(HCL) file. Valid when --provider/-p is set.
|
|
-o, --output string Specify the output path of the generated definition. If empty, the definition will be printed in the console.
|
|
--path string Specify which path the configuration(HCL) is stored in the Git repository. Valid when --git is set.
|
|
-p, --provider alibaba Specify which provider the cloud resource definition belongs to. Only alibaba, `aws`, `azure` are supported.
|
|
-f, --template-yaml string Specify the template yaml file that definition will use to build the schema. If empty, a default template for the given definition type will be used.
|
|
-t, --type string Specify the type of the new definition. Valid types: component, trait, policy, workload, scope, workflow-step
|
|
```
|
|
|
|
### Options inherited from parent commands
|
|
|
|
```
|
|
-y, --yes Assume yes for all user prompts
|
|
```
|
|
|
|
### SEE ALSO
|
|
|
|
* [vela def](vela_def) - Manage Definitions
|
|
|
|
#### Go Back to [CLI Commands](vela) Homepage.
|
|
|
|
|
|
###### Auto generated by [spf13/cobra script in KubeVela](https://github.com/kubevela/kubevela/tree/master/hack/docgen).
|