Skip to content

Commit

Permalink
Add system banner profile parcel resource
Browse files Browse the repository at this point in the history
  • Loading branch information
danischm committed Nov 27, 2023
1 parent cd44d47 commit ddaf801
Show file tree
Hide file tree
Showing 25 changed files with 1,113 additions and 33 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Add `sdwan_transport_feature_profile` resource and data source
- Add `sdwan_cli_feature_profile` resource and data source
- Add `sdwan_system_aaa_profile_parcel` resource and data source
- Add `sdwan_system_banner_profile_parcel` resource and data source

## 0.2.11

Expand Down
38 changes: 38 additions & 0 deletions docs/data-sources/system_banner_profile_parcel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "sdwan_system_banner_profile_parcel Data Source - terraform-provider-sdwan"
subcategory: "Profile Parcels"
description: |-
This data source can read the System Banner profile parcel.
---

# sdwan_system_banner_profile_parcel (Data Source)

This data source can read the System Banner profile parcel.

## Example Usage

```terraform
data "sdwan_system_banner_profile_parcel" "example" {
id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
}
```

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

### Required

- `feature_profile_id` (String) Feature Profile ID
- `id` (String) The id of the profile parcel

### Read-Only

- `description` (String) The description of the profile parcel
- `login` (String)
- `login_variable` (String) Variable name
- `motd` (String)
- `motd_variable` (String) Variable name
- `name` (String) The name of the profile parcel
- `version` (Number) The version of the profile parcel
1 change: 1 addition & 0 deletions docs/guides/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ description: |-
- Add `sdwan_transport_feature_profile` resource and data source
- Add `sdwan_cli_feature_profile` resource and data source
- Add `sdwan_system_aaa_profile_parcel` resource and data source
- Add `sdwan_system_banner_profile_parcel` resource and data source

## 0.2.11

Expand Down
8 changes: 8 additions & 0 deletions docs/resources/system_aaa_profile_parcel.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ Optional:
- `source_interface_variable` (String) Variable name
- `vpn` (Number) Set VPN in which Radius server is located
- Range: `0`-`65530`
- Default value: `0`

<a id="nestedatt--radius_groups--servers"></a>
### Nested Schema for `radius_groups.servers`
Expand All @@ -180,10 +181,12 @@ Optional:

- `acct_port` (Number) Set Accounting port to use to connect to Radius server
- Range: `1`-`65534`
- Default value: `1813`
- `acct_port_variable` (String) Variable name
- `address` (String) Set IP address of Radius server
- `auth_port` (Number) Set Authentication port to use to connect to Radius server
- Range: `1`-`65534`
- Default value: `1812`
- `auth_port_variable` (String) Variable name
- `key` (String) Set the Radius server shared key
- `key_enum` (String) Type of encyption. To be used for type 6
Expand All @@ -194,11 +197,13 @@ Optional:
- `key_type_variable` (String) Variable name
- `retransmit` (Number) Configure how many times to contact this Radius server
- Range: `1`-`100`
- Default value: `3`
- `retransmit_variable` (String) Variable name
- `secret_key` (String) Set the Radius server shared type 7 encrypted key
- `secret_key_variable` (String) Variable name
- `timeout` (Number) Configure how long to wait for replies from the Radius server
- Range: `1`-`1000`
- Default value: `5`
- `timeout_variable` (String) Variable name


Expand All @@ -214,6 +219,7 @@ Optional:
- `source_interface_variable` (String) Variable name
- `vpn` (Number) Set VPN in which TACACS server is located
- Range: `0`-`65530`
- Default value: `0`

<a id="nestedatt--tacacs_groups--servers"></a>
### Nested Schema for `tacacs_groups.servers`
Expand All @@ -226,11 +232,13 @@ Optional:
- Choices: `6`, `7`
- `port` (Number) TACACS Port
- Range: `1`-`65535`
- Default value: `49`
- `port_variable` (String) Variable name
- `secret_key` (String) Set the TACACS server shared type 7 encrypted key
- `secret_key_variable` (String) Variable name
- `timeout` (Number) Configure how long to wait for replies from the TACACS server
- Range: `1`-`1000`
- Default value: `5`
- `timeout_variable` (String) Variable name


Expand Down
54 changes: 54 additions & 0 deletions docs/resources/system_banner_profile_parcel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "sdwan_system_banner_profile_parcel Resource - terraform-provider-sdwan"
subcategory: "Profile Parcels"
description: |-
This resource can manage a System Banner profile parcel.
- Minimum SD-WAN Manager version: 20.12.0
---

# sdwan_system_banner_profile_parcel (Resource)

This resource can manage a System Banner profile parcel.
- Minimum SD-WAN Manager version: `20.12.0`

## Example Usage

```terraform
resource "sdwan_system_banner_profile_parcel" "example" {
name = "Example"
description = "My Example"
feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
login = "My login banner"
motd = "My motd banner"
}
```

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

### Required

- `description` (String) The description of the profile parcel
- `name` (String) The name of the profile parcel

### Optional

- `feature_profile_id` (String) Feature Profile ID
- `login` (String)
- `login_variable` (String) Variable name
- `motd` (String)
- `motd_variable` (String) Variable name

### Read-Only

- `id` (String) The id of the profile parcel
- `version` (Number) The version of the profile parcel

## Import

Import is supported using the following syntax:

```shell
terraform import sdwan_system_banner_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
data "sdwan_system_banner_profile_parcel" "example" {
id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import sdwan_system_banner_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resource "sdwan_system_banner_profile_parcel" "example" {
name = "Example"
description = "My Example"
feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
login = "My login banner"
motd = "My motd banner"
}
21 changes: 21 additions & 0 deletions gen/definitions/profile_parcels/system_banner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: System Banner
rest_endpoint: /v1/feature-profile/sdwan/system/%v/banner
minimum_version: 20.12.0
attributes:
- tf_name: feature_profile_id
reference: true
type: String
description: Feature Profile ID
example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac
test_value: sdwan_system_feature_profile.test.id
- model_name: login
example: My login banner
- model_name: motd
example: My motd banner

test_prerequisites: |
resource "sdwan_system_feature_profile" "test" {
name = "TF_TEST"
description = "Terraform test"
}
20 changes: 17 additions & 3 deletions gen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ type YamlConfigAttribute struct {
Reference bool `yaml:"reference"`
Variable bool `yaml:"variable"`
Mandatory bool `yaml:"mandatory"`
ParcelMandatory bool `yaml:"parcel_mandatory"`
WriteOnly bool `yaml:"write_only"`
TfOnly bool `yaml:"tf_only"`
ExcludeTest bool `yaml:"exclude_test"`
Expand Down Expand Up @@ -601,9 +602,22 @@ func parseProfileParcelAttribute(attr *YamlConfigAttribute, model gjson.Result)
}
d := r.Get("oneOf.#(properties.optionType.enum.0=\"default\")")
if d.Exists() {
attr.DefaultValue = d.Get("properties.value.enum.0").String()
} else if !attr.Variable {
attr.Mandatory = true
if value := d.Get("properties.value.enum.0"); value.Exists() {
attr.DefaultValue = value.String()
} else if value := d.Get("properties.value.default"); value.Exists() {
attr.DefaultValue = value.String()
} else if value := d.Get("properties.value.default"); value.Exists() {
attr.DefaultValue = value.String()
} else if value := d.Get("properties.value.minimum"); value.Exists() {
attr.DefaultValue = value.String()
} else {
attr.DefaultValue = ""
}
} else {
attr.ParcelMandatory = true
if !attr.Variable {
attr.Mandatory = true
}
}
} else if r.Get("type").String() == "array" && r.Get("items.type").String() == "object" && len(attr.Attributes) > 0 {
attr.Type = "List"
Expand Down
Loading

0 comments on commit ddaf801

Please sign in to comment.