Skip to content

Commit

Permalink
Add template resource and data source
Browse files Browse the repository at this point in the history
  • Loading branch information
danischm committed Nov 17, 2023
1 parent 5d4f71e commit 08a8f8e
Show file tree
Hide file tree
Showing 21 changed files with 1,912 additions and 27 deletions.
78 changes: 78 additions & 0 deletions docs/data-sources/template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "catalystcenter_template Data Source - terraform-provider-catalystcenter"
subcategory: "Templates"
description: |-
This data source can read the Template.
---

# catalystcenter_template (Data Source)

This data source can read the Template.

## Example Usage

```terraform
data "catalystcenter_template" "example" {
id = "76d24097-41c4-4558-a4d0-a8c07ac08470"
project_id = "12345678-1234-1234-1234-123456789012"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `id` (String) The id of the object
- `project_id` (String) The ID of the project

### Read-Only

- `description` (String) Description
- `device_types` (Attributes List) List of device types (see [below for nested schema](#nestedatt--device_types))
- `language` (String) Language of the template
- `name` (String) Name of the template
- `software_type` (String) Software type
- `software_variant` (String) Software variant
- `software_version` (String) Software version
- `template_content` (String) Template content
- `template_params` (Attributes List) List of template parameters (see [below for nested schema](#nestedatt--template_params))

<a id="nestedatt--device_types"></a>
### Nested Schema for `device_types`

Read-Only:

- `product_family` (String) Product family
- `product_series` (String) Product series
- `product_type` (String) Product type


<a id="nestedatt--template_params"></a>
### Nested Schema for `template_params`

Read-Only:

- `binding` (String) Bind to source
- `data_type` (String) Datatype of template parameter
- `default_selected_values` (List of String) Default selection values
- `default_value` (String) Default value of template parameter
- `description` (String) Description of template parameter
- `display_name` (String) Display name of template parameter
- `instruction_text` (String) Instruction text
- `not_param` (Boolean) Is it not a variable
- `param_array` (Boolean) Is it an array
- `parameter_name` (String) Name of the template parameter
- `ranges` (Attributes List) List of ranges (see [below for nested schema](#nestedatt--template_params--ranges))
- `required` (Boolean) Is parameter required
- `selection_type` (String) Type of selection
- `selection_values` (Map of String) Selection values

<a id="nestedatt--template_params--ranges"></a>
### Nested Schema for `template_params.ranges`

Read-Only:

- `max_value` (Number) Max value of range
- `min_value` (Number) Min value of range
126 changes: 126 additions & 0 deletions docs/resources/template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "catalystcenter_template Resource - terraform-provider-catalystcenter"
subcategory: "Templates"
description: |-
This resource can manage a Template.
---

# catalystcenter_template (Resource)

This resource can manage a Template.

## Example Usage

```terraform
resource "catalystcenter_template" "example" {
project_id = "12345678-1234-1234-1234-123456789012"
name = "Template1"
description = "My description"
device_types = [
{
product_family = "Switches and Hubs"
product_series = "Cisco Catalyst 9300 Series Switches"
product_type = "Cisco Catalyst 9300 Switch"
}
]
language = "JINJA"
software_type = "IOS-XE"
software_variant = "XE"
software_version = "16.12.1a"
template_content = "hostname {{hostname}}"
template_params = [
{
data_type = "STRING"
default_value = "ABC"
description = "My parameter"
display_name = "Custom hostname"
instruction_text = "My instructions"
not_param = false
param_array = false
parameter_name = "hostname"
required = false
selection_type = "SINGLE_SELECT"
selection_values = { host1 = "host1" }
}
]
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `device_types` (Attributes List) List of device types (see [below for nested schema](#nestedatt--device_types))
- `language` (String) Language of the template
- Choices: `JINJA`, `VELOCITY`
- `name` (String) Name of the template
- `project_id` (String) The ID of the project
- `software_type` (String) Software type

### Optional

- `description` (String) Description
- `software_variant` (String) Software variant
- `software_version` (String) Software version
- `template_content` (String) Template content
- `template_params` (Attributes List) List of template parameters (see [below for nested schema](#nestedatt--template_params))

### Read-Only

- `id` (String) The id of the object

<a id="nestedatt--device_types"></a>
### Nested Schema for `device_types`

Required:

- `product_family` (String) Product family

Optional:

- `product_series` (String) Product series
- `product_type` (String) Product type


<a id="nestedatt--template_params"></a>
### Nested Schema for `template_params`

Required:

- `data_type` (String) Datatype of template parameter
- Choices: `STRING`, `INTEGER`, `IPADDRESS`, `MACADDRESS`, `SECTIONDIVIDER`
- `selection_type` (String) Type of selection
- Choices: `SINGLE_SELECT`, `MULTI_SELECT`

Optional:

- `binding` (String) Bind to source
- `default_selected_values` (List of String) Default selection values
- `default_value` (String) Default value of template parameter
- `description` (String) Description of template parameter
- `display_name` (String) Display name of template parameter
- `instruction_text` (String) Instruction text
- `not_param` (Boolean) Is it not a variable
- `param_array` (Boolean) Is it an array
- `parameter_name` (String) Name of the template parameter
- `ranges` (Attributes List) List of ranges (see [below for nested schema](#nestedatt--template_params--ranges))
- `required` (Boolean) Is parameter required
- `selection_values` (Map of String) Selection values

<a id="nestedatt--template_params--ranges"></a>
### Nested Schema for `template_params.ranges`

Optional:

- `max_value` (Number) Max value of range
- `min_value` (Number) Min value of range

## Import

Import is supported using the following syntax:

```shell
terraform import catalystcenter_template.example "4b0b7a80-44c0-4bf2-bab5-fc24b4e0a17e"
```
4 changes: 4 additions & 0 deletions examples/data-sources/catalystcenter_template/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
data "catalystcenter_template" "example" {
id = "76d24097-41c4-4558-a4d0-a8c07ac08470"
project_id = "12345678-1234-1234-1234-123456789012"
}
1 change: 1 addition & 0 deletions examples/resources/catalystcenter_template/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import catalystcenter_template.example "4b0b7a80-44c0-4bf2-bab5-fc24b4e0a17e"
32 changes: 32 additions & 0 deletions examples/resources/catalystcenter_template/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
resource "catalystcenter_template" "example" {
project_id = "12345678-1234-1234-1234-123456789012"
name = "Template1"
description = "My description"
device_types = [
{
product_family = "Switches and Hubs"
product_series = "Cisco Catalyst 9300 Series Switches"
product_type = "Cisco Catalyst 9300 Switch"
}
]
language = "JINJA"
software_type = "IOS-XE"
software_variant = "XE"
software_version = "16.12.1a"
template_content = "hostname {{hostname}}"
template_params = [
{
data_type = "STRING"
default_value = "ABC"
description = "My parameter"
display_name = "Custom hostname"
instruction_text = "My instructions"
not_param = false
param_array = false
parameter_name = "hostname"
required = false
selection_type = "SINGLE_SELECT"
selection_values = { host1 = "host1" }
}
]
}
2 changes: 0 additions & 2 deletions gen/definitions/project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ id_path: response.data
doc_category: Templates
attributes:
- model_name: name
response_data_path: name
type: String
mandatory: true
description: The name of the project
example: Project1
- model_name: description
response_data_path: description
type: String
description: Description
example: My description
Loading

0 comments on commit 08a8f8e

Please sign in to comment.