|
1 | | -# Step-type Resource |
| 1 | +# Step-types Resource |
2 | 2 |
|
3 | | -The Step-type resource allows to create your own typed step. |
| 3 | +The Step-types resource allows to create your own typed step and manage all it's published versions. |
| 4 | +The resource allows to handle the life-cycle of the version by allowing specifying multiple blocks `version` where the user provides a version number and the yaml file representing the plugin. |
4 | 5 | More about custom steps in the [official documentation](https://codefresh.io/docs/docs/codefresh-yaml/steps/#creating-a-typed-codefresh-plugin). |
5 | 6 |
|
6 | 7 | ## Known limitations and disclaimers |
7 | | -### Differences during plan phase |
8 | | -When executing `terraform plan` the diff presented will be the comparison between the latest published version and the version configured in the `step_types_yaml`. |
9 | | -At this stage the Read function doesn't have the reference to the new version in order to be able to retrieve the exact version for comparison. |
| 8 | +### Version and name in yaml Metadata are ignored. |
| 9 | +The version and name of the step declared in the yaml files are superseeded by the attributes specified at resource level: |
| 10 | +- `name` : at top level |
| 11 | +- `version_numer`: specified in the `version` block |
| 12 | +The above are added/replaced at runtime time. |
| 13 | + |
| 14 | +### Number of API requests |
| 15 | +This resource makes a lot of additional API calls to validate the steps and retrieve all the version available. |
| 16 | +Caution is recommended on the amount of versions maintained and the number of resources defined in a single project. |
10 | 17 |
|
11 | | -### Deletion of resource |
12 | | -When executing `terraform destroy` the step-stype is completely removed (including all the existing version) |
13 | 18 |
|
14 | 19 | ## Example Usage |
15 | 20 |
|
16 | 21 | ```hcl |
17 | | -resource "codefresh_step_types" "custom_step" { |
18 | | - |
19 | | - # NOTE: you can also load the yaml from a file with `step_types_yaml = file("PATH-TO-FILE.yaml")` |
20 | | - # Example has been cut down for simplicity. Yaml schema must be compliant with the what specified in the documentation for typed plugins |
21 | | - step_types_yaml = <<YAML |
22 | | -version: '1.0' |
23 | | -kind: step-type |
24 | | -metadata: |
25 | | - name: <ACCOUNT_NAME>/custom-step |
26 | | - ... |
27 | | -spec: |
28 | | - arguments: |- |
29 | | - { |
30 | | - .... |
31 | | - } |
32 | | -delimiters: |
33 | | - left: '[[' |
34 | | - right: ']]' |
35 | | - stepsTemplate: |- |
36 | | - print_info_message: |
37 | | - name: Test step |
38 | | - ... |
39 | | -YAML |
| 22 | +
|
| 23 | +data "codefresh_current_account" "acc" { |
| 24 | +} |
| 25 | +
|
| 26 | +resource "codefresh_step_types_versions" "my-custom-step" { |
| 27 | + name = "${data.codefresh_current_account.acc.name}/my-custom-step" |
| 28 | +
|
| 29 | + version { |
| 30 | + version_number = "0.0.1" |
| 31 | + step_types_yaml = file("./templates/plugin-0.0.1.yaml") |
| 32 | + } |
| 33 | + version { |
| 34 | + version_number = "0.0.2" |
| 35 | + step_types_yaml = file("./templates/plugin-0.0.2.yaml") |
| 36 | + } |
| 37 | + .... |
| 38 | +} |
40 | 39 | } |
41 | 40 | ``` |
42 | 41 |
|
43 | 42 | ## Argument Reference |
| 43 | +- `name` - (Required) The name for the step-type |
| 44 | +- `version` - (At least 1 Required) A collection of `version` blocks as documented below. |
44 | 45 |
|
45 | | -- `step_types_yaml` (Required) YAML String containing a valid definition of a typed plugin |
46 | | - |
| 46 | +--- |
47 | 47 |
|
| 48 | +`version` supports the following: |
| 49 | +- `version_number` - (Required) String representing the semVer for the step |
| 50 | +- `step_types_yaml` (Required) YAML String containing a valid definition of a typed plugin |
0 commit comments