Skip to content

Commit 08a8f8e

Browse files
committed
Add template resource and data source
1 parent 5d4f71e commit 08a8f8e

21 files changed

+1912
-27
lines changed

docs/data-sources/template.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "catalystcenter_template Data Source - terraform-provider-catalystcenter"
4+
subcategory: "Templates"
5+
description: |-
6+
This data source can read the Template.
7+
---
8+
9+
# catalystcenter_template (Data Source)
10+
11+
This data source can read the Template.
12+
13+
## Example Usage
14+
15+
```terraform
16+
data "catalystcenter_template" "example" {
17+
id = "76d24097-41c4-4558-a4d0-a8c07ac08470"
18+
project_id = "12345678-1234-1234-1234-123456789012"
19+
}
20+
```
21+
22+
<!-- schema generated by tfplugindocs -->
23+
## Schema
24+
25+
### Required
26+
27+
- `id` (String) The id of the object
28+
- `project_id` (String) The ID of the project
29+
30+
### Read-Only
31+
32+
- `description` (String) Description
33+
- `device_types` (Attributes List) List of device types (see [below for nested schema](#nestedatt--device_types))
34+
- `language` (String) Language of the template
35+
- `name` (String) Name of the template
36+
- `software_type` (String) Software type
37+
- `software_variant` (String) Software variant
38+
- `software_version` (String) Software version
39+
- `template_content` (String) Template content
40+
- `template_params` (Attributes List) List of template parameters (see [below for nested schema](#nestedatt--template_params))
41+
42+
<a id="nestedatt--device_types"></a>
43+
### Nested Schema for `device_types`
44+
45+
Read-Only:
46+
47+
- `product_family` (String) Product family
48+
- `product_series` (String) Product series
49+
- `product_type` (String) Product type
50+
51+
52+
<a id="nestedatt--template_params"></a>
53+
### Nested Schema for `template_params`
54+
55+
Read-Only:
56+
57+
- `binding` (String) Bind to source
58+
- `data_type` (String) Datatype of template parameter
59+
- `default_selected_values` (List of String) Default selection values
60+
- `default_value` (String) Default value of template parameter
61+
- `description` (String) Description of template parameter
62+
- `display_name` (String) Display name of template parameter
63+
- `instruction_text` (String) Instruction text
64+
- `not_param` (Boolean) Is it not a variable
65+
- `param_array` (Boolean) Is it an array
66+
- `parameter_name` (String) Name of the template parameter
67+
- `ranges` (Attributes List) List of ranges (see [below for nested schema](#nestedatt--template_params--ranges))
68+
- `required` (Boolean) Is parameter required
69+
- `selection_type` (String) Type of selection
70+
- `selection_values` (Map of String) Selection values
71+
72+
<a id="nestedatt--template_params--ranges"></a>
73+
### Nested Schema for `template_params.ranges`
74+
75+
Read-Only:
76+
77+
- `max_value` (Number) Max value of range
78+
- `min_value` (Number) Min value of range

docs/resources/template.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "catalystcenter_template Resource - terraform-provider-catalystcenter"
4+
subcategory: "Templates"
5+
description: |-
6+
This resource can manage a Template.
7+
---
8+
9+
# catalystcenter_template (Resource)
10+
11+
This resource can manage a Template.
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "catalystcenter_template" "example" {
17+
project_id = "12345678-1234-1234-1234-123456789012"
18+
name = "Template1"
19+
description = "My description"
20+
device_types = [
21+
{
22+
product_family = "Switches and Hubs"
23+
product_series = "Cisco Catalyst 9300 Series Switches"
24+
product_type = "Cisco Catalyst 9300 Switch"
25+
}
26+
]
27+
language = "JINJA"
28+
software_type = "IOS-XE"
29+
software_variant = "XE"
30+
software_version = "16.12.1a"
31+
template_content = "hostname {{hostname}}"
32+
template_params = [
33+
{
34+
data_type = "STRING"
35+
default_value = "ABC"
36+
description = "My parameter"
37+
display_name = "Custom hostname"
38+
instruction_text = "My instructions"
39+
not_param = false
40+
param_array = false
41+
parameter_name = "hostname"
42+
required = false
43+
selection_type = "SINGLE_SELECT"
44+
selection_values = { host1 = "host1" }
45+
}
46+
]
47+
}
48+
```
49+
50+
<!-- schema generated by tfplugindocs -->
51+
## Schema
52+
53+
### Required
54+
55+
- `device_types` (Attributes List) List of device types (see [below for nested schema](#nestedatt--device_types))
56+
- `language` (String) Language of the template
57+
- Choices: `JINJA`, `VELOCITY`
58+
- `name` (String) Name of the template
59+
- `project_id` (String) The ID of the project
60+
- `software_type` (String) Software type
61+
62+
### Optional
63+
64+
- `description` (String) Description
65+
- `software_variant` (String) Software variant
66+
- `software_version` (String) Software version
67+
- `template_content` (String) Template content
68+
- `template_params` (Attributes List) List of template parameters (see [below for nested schema](#nestedatt--template_params))
69+
70+
### Read-Only
71+
72+
- `id` (String) The id of the object
73+
74+
<a id="nestedatt--device_types"></a>
75+
### Nested Schema for `device_types`
76+
77+
Required:
78+
79+
- `product_family` (String) Product family
80+
81+
Optional:
82+
83+
- `product_series` (String) Product series
84+
- `product_type` (String) Product type
85+
86+
87+
<a id="nestedatt--template_params"></a>
88+
### Nested Schema for `template_params`
89+
90+
Required:
91+
92+
- `data_type` (String) Datatype of template parameter
93+
- Choices: `STRING`, `INTEGER`, `IPADDRESS`, `MACADDRESS`, `SECTIONDIVIDER`
94+
- `selection_type` (String) Type of selection
95+
- Choices: `SINGLE_SELECT`, `MULTI_SELECT`
96+
97+
Optional:
98+
99+
- `binding` (String) Bind to source
100+
- `default_selected_values` (List of String) Default selection values
101+
- `default_value` (String) Default value of template parameter
102+
- `description` (String) Description of template parameter
103+
- `display_name` (String) Display name of template parameter
104+
- `instruction_text` (String) Instruction text
105+
- `not_param` (Boolean) Is it not a variable
106+
- `param_array` (Boolean) Is it an array
107+
- `parameter_name` (String) Name of the template parameter
108+
- `ranges` (Attributes List) List of ranges (see [below for nested schema](#nestedatt--template_params--ranges))
109+
- `required` (Boolean) Is parameter required
110+
- `selection_values` (Map of String) Selection values
111+
112+
<a id="nestedatt--template_params--ranges"></a>
113+
### Nested Schema for `template_params.ranges`
114+
115+
Optional:
116+
117+
- `max_value` (Number) Max value of range
118+
- `min_value` (Number) Min value of range
119+
120+
## Import
121+
122+
Import is supported using the following syntax:
123+
124+
```shell
125+
terraform import catalystcenter_template.example "4b0b7a80-44c0-4bf2-bab5-fc24b4e0a17e"
126+
```
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
data "catalystcenter_template" "example" {
2+
id = "76d24097-41c4-4558-a4d0-a8c07ac08470"
3+
project_id = "12345678-1234-1234-1234-123456789012"
4+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
terraform import catalystcenter_template.example "4b0b7a80-44c0-4bf2-bab5-fc24b4e0a17e"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
resource "catalystcenter_template" "example" {
2+
project_id = "12345678-1234-1234-1234-123456789012"
3+
name = "Template1"
4+
description = "My description"
5+
device_types = [
6+
{
7+
product_family = "Switches and Hubs"
8+
product_series = "Cisco Catalyst 9300 Series Switches"
9+
product_type = "Cisco Catalyst 9300 Switch"
10+
}
11+
]
12+
language = "JINJA"
13+
software_type = "IOS-XE"
14+
software_variant = "XE"
15+
software_version = "16.12.1a"
16+
template_content = "hostname {{hostname}}"
17+
template_params = [
18+
{
19+
data_type = "STRING"
20+
default_value = "ABC"
21+
description = "My parameter"
22+
display_name = "Custom hostname"
23+
instruction_text = "My instructions"
24+
not_param = false
25+
param_array = false
26+
parameter_name = "hostname"
27+
required = false
28+
selection_type = "SINGLE_SELECT"
29+
selection_values = { host1 = "host1" }
30+
}
31+
]
32+
}

gen/definitions/project.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ id_path: response.data
88
doc_category: Templates
99
attributes:
1010
- model_name: name
11-
response_data_path: name
1211
type: String
1312
mandatory: true
1413
description: The name of the project
1514
example: Project1
1615
- model_name: description
17-
response_data_path: description
1816
type: String
1917
description: Description
2018
example: My description

0 commit comments

Comments
 (0)