Skip to content

Commit

Permalink
make all attributes in aaa_settings optional
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba-mazurkiewicz committed Mar 4, 2025
1 parent d576826 commit 49057ba
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 29 deletions.
20 changes: 11 additions & 9 deletions docs/resources/aaa_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ resource "catalystcenter_aaa_settings" "example" {
site_id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1"
network_aaa_server_type = "AAA"
network_aaa_protocol = "RADIUS"
network_aaa_pan = "1.2.3.4"
network_aaa_primary_server_ip = "1.2.3.4"
network_aaa_secondary_server_ip = "1.2.3.5"
network_aaa_shared_secret = "Secret123"
client_aaa_server_type = "AAA"
client_aaa_protocol = "RADIUS"
client_aaa_pan = "1.2.3.4"
client_aaa_primary_server_ip = "1.2.3.4"
client_aaa_secondary_server_ip = "1.2.3.5"
client_aaa_shared_secret = "Secret123"
Expand All @@ -33,25 +35,25 @@ resource "catalystcenter_aaa_settings" "example" {

### Required

- `site_id` (String) The site ID

### Optional

- `client_aaa_pan` (String) Administration Node. Required for ISE
- `client_aaa_primary_server_ip` (String) The server to use as a primary
- `client_aaa_protocol` (String) Server protocol
- Choices: `RADIUS`, `TACACS`
- `client_aaa_secondary_server_ip` (String) The server to use as a secondary
- `client_aaa_server_type` (String) Type of client AAA server
- Choices: `AAA`, `ISE`
- `client_aaa_shared_secret` (String) Only relevant for server type `ISE`, shared secret
- `network_aaa_pan` (String) Administration Node. Required for ISE
- `network_aaa_primary_server_ip` (String) The server to use as a primary
- `network_aaa_protocol` (String) Server protocol
- Choices: `RADIUS`, `TACACS`
- `network_aaa_secondary_server_ip` (String) The server to use as a secondary
- `network_aaa_server_type` (String) Type of network AAA server
- Choices: `AAA`, `ISE`
- `site_id` (String) The site ID

### Optional

- `client_aaa_pan` (String) Administration Node. Required for ISE
- `client_aaa_secondary_server_ip` (String) The server to use as a secondary
- `client_aaa_shared_secret` (String) Only relevant for server type `ISE`, shared secret
- `network_aaa_pan` (String) Administration Node. Required for ISE
- `network_aaa_secondary_server_ip` (String) The server to use as a secondary
- `network_aaa_shared_secret` (String) Only relevant for server type `ISE`, shared secret

### Read-Only
Expand Down
2 changes: 2 additions & 0 deletions examples/resources/catalystcenter_aaa_settings/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ resource "catalystcenter_aaa_settings" "example" {
site_id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1"
network_aaa_server_type = "AAA"
network_aaa_protocol = "RADIUS"
network_aaa_pan = "1.2.3.4"
network_aaa_primary_server_ip = "1.2.3.4"
network_aaa_secondary_server_ip = "1.2.3.5"
network_aaa_shared_secret = "Secret123"
client_aaa_server_type = "AAA"
client_aaa_protocol = "RADIUS"
client_aaa_pan = "1.2.3.4"
client_aaa_primary_server_ip = "1.2.3.4"
client_aaa_secondary_server_ip = "1.2.3.5"
client_aaa_shared_secret = "Secret123"
Expand Down
10 changes: 2 additions & 8 deletions gen/definitions/aaa_settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ attributes:
response_data_path: response.aaaNetwork.serverType
tf_name: network_aaa_server_type
type: String
mandatory: true
enum_values: [AAA, ISE]
description: Type of network AAA server
example: AAA
Expand All @@ -33,7 +32,6 @@ attributes:
response_data_path: response.aaaNetwork.protocol
tf_name: network_aaa_protocol
type: String
mandatory: true
enum_values: [RADIUS, TACACS]
description: Server protocol
example: RADIUS
Expand All @@ -43,12 +41,11 @@ attributes:
tf_name: network_aaa_pan
type: String
description: Administration Node. Required for ISE
exclude_test: true
example: 1.2.3.4
- model_name: primaryServerIp
data_path: aaaNetwork
response_data_path: response.aaaNetwork.primaryServerIp
tf_name: network_aaa_primary_server_ip
mandatory: true
type: String
description: The server to use as a primary
example: 1.2.3.4
Expand All @@ -72,7 +69,6 @@ attributes:
response_data_path: response.aaaClient.serverType
tf_name: client_aaa_server_type
type: String
mandatory: true
enum_values: [AAA, ISE]
description: Type of client AAA server
example: AAA
Expand All @@ -81,7 +77,6 @@ attributes:
response_data_path: response.aaaClient.protocol
tf_name: client_aaa_protocol
type: String
mandatory: true
enum_values: [RADIUS, TACACS]
description: Server protocol
example: RADIUS
Expand All @@ -91,12 +86,11 @@ attributes:
tf_name: client_aaa_pan
type: String
description: Administration Node. Required for ISE
exclude_test: true
example: 1.2.3.4
- model_name: primaryServerIp
data_path: aaaClient
response_data_path: response.aaaClient.primaryServerIp
tf_name: client_aaa_primary_server_ip
mandatory: true
type: String
description: The server to use as a primary
example: 1.2.3.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ func TestAccDataSourceCcAAASettings(t *testing.T) {
var checks []resource.TestCheckFunc
checks = append(checks, resource.TestCheckResourceAttr("data.catalystcenter_aaa_settings.test", "network_aaa_server_type", "AAA"))
checks = append(checks, resource.TestCheckResourceAttr("data.catalystcenter_aaa_settings.test", "network_aaa_protocol", "RADIUS"))
checks = append(checks, resource.TestCheckResourceAttr("data.catalystcenter_aaa_settings.test", "network_aaa_pan", "1.2.3.4"))
checks = append(checks, resource.TestCheckResourceAttr("data.catalystcenter_aaa_settings.test", "network_aaa_primary_server_ip", "1.2.3.4"))
checks = append(checks, resource.TestCheckResourceAttr("data.catalystcenter_aaa_settings.test", "network_aaa_secondary_server_ip", "1.2.3.5"))
checks = append(checks, resource.TestCheckResourceAttr("data.catalystcenter_aaa_settings.test", "client_aaa_server_type", "AAA"))
checks = append(checks, resource.TestCheckResourceAttr("data.catalystcenter_aaa_settings.test", "client_aaa_protocol", "RADIUS"))
checks = append(checks, resource.TestCheckResourceAttr("data.catalystcenter_aaa_settings.test", "client_aaa_pan", "1.2.3.4"))
checks = append(checks, resource.TestCheckResourceAttr("data.catalystcenter_aaa_settings.test", "client_aaa_primary_server_ip", "1.2.3.4"))
checks = append(checks, resource.TestCheckResourceAttr("data.catalystcenter_aaa_settings.test", "client_aaa_secondary_server_ip", "1.2.3.5"))
resource.Test(t, resource.TestCase{
Expand Down Expand Up @@ -72,11 +74,13 @@ func testAccDataSourceCcAAASettingsConfig() string {
config += ` site_id = catalystcenter_area.test.id` + "\n"
config += ` network_aaa_server_type = "AAA"` + "\n"
config += ` network_aaa_protocol = "RADIUS"` + "\n"
config += ` network_aaa_pan = "1.2.3.4"` + "\n"
config += ` network_aaa_primary_server_ip = "1.2.3.4"` + "\n"
config += ` network_aaa_secondary_server_ip = "1.2.3.5"` + "\n"
config += ` network_aaa_shared_secret = "Secret123"` + "\n"
config += ` client_aaa_server_type = "AAA"` + "\n"
config += ` client_aaa_protocol = "RADIUS"` + "\n"
config += ` client_aaa_pan = "1.2.3.4"` + "\n"
config += ` client_aaa_primary_server_ip = "1.2.3.4"` + "\n"
config += ` client_aaa_secondary_server_ip = "1.2.3.5"` + "\n"
config += ` client_aaa_shared_secret = "Secret123"` + "\n"
Expand Down
12 changes: 6 additions & 6 deletions internal/provider/resource_catalystcenter_aaa_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ func (r *AAASettingsResource) Schema(ctx context.Context, req resource.SchemaReq
},
"network_aaa_server_type": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Type of network AAA server").AddStringEnumDescription("AAA", "ISE").String,
Required: true,
Optional: true,
Validators: []validator.String{
stringvalidator.OneOf("AAA", "ISE"),
},
},
"network_aaa_protocol": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Server protocol").AddStringEnumDescription("RADIUS", "TACACS").String,
Required: true,
Optional: true,
Validators: []validator.String{
stringvalidator.OneOf("RADIUS", "TACACS"),
},
Expand All @@ -96,7 +96,7 @@ func (r *AAASettingsResource) Schema(ctx context.Context, req resource.SchemaReq
},
"network_aaa_primary_server_ip": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("The server to use as a primary").String,
Required: true,
Optional: true,
},
"network_aaa_secondary_server_ip": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("The server to use as a secondary").String,
Expand All @@ -108,14 +108,14 @@ func (r *AAASettingsResource) Schema(ctx context.Context, req resource.SchemaReq
},
"client_aaa_server_type": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Type of client AAA server").AddStringEnumDescription("AAA", "ISE").String,
Required: true,
Optional: true,
Validators: []validator.String{
stringvalidator.OneOf("AAA", "ISE"),
},
},
"client_aaa_protocol": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Server protocol").AddStringEnumDescription("RADIUS", "TACACS").String,
Required: true,
Optional: true,
Validators: []validator.String{
stringvalidator.OneOf("RADIUS", "TACACS"),
},
Expand All @@ -126,7 +126,7 @@ func (r *AAASettingsResource) Schema(ctx context.Context, req resource.SchemaReq
},
"client_aaa_primary_server_ip": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("The server to use as a primary").String,
Required: true,
Optional: true,
},
"client_aaa_secondary_server_ip": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("The server to use as a secondary").String,
Expand Down
10 changes: 4 additions & 6 deletions internal/provider/resource_catalystcenter_aaa_settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ func TestAccCcAAASettings(t *testing.T) {
var checks []resource.TestCheckFunc
checks = append(checks, resource.TestCheckResourceAttr("catalystcenter_aaa_settings.test", "network_aaa_server_type", "AAA"))
checks = append(checks, resource.TestCheckResourceAttr("catalystcenter_aaa_settings.test", "network_aaa_protocol", "RADIUS"))
checks = append(checks, resource.TestCheckResourceAttr("catalystcenter_aaa_settings.test", "network_aaa_pan", "1.2.3.4"))
checks = append(checks, resource.TestCheckResourceAttr("catalystcenter_aaa_settings.test", "network_aaa_primary_server_ip", "1.2.3.4"))
checks = append(checks, resource.TestCheckResourceAttr("catalystcenter_aaa_settings.test", "network_aaa_secondary_server_ip", "1.2.3.5"))
checks = append(checks, resource.TestCheckResourceAttr("catalystcenter_aaa_settings.test", "client_aaa_server_type", "AAA"))
checks = append(checks, resource.TestCheckResourceAttr("catalystcenter_aaa_settings.test", "client_aaa_protocol", "RADIUS"))
checks = append(checks, resource.TestCheckResourceAttr("catalystcenter_aaa_settings.test", "client_aaa_pan", "1.2.3.4"))
checks = append(checks, resource.TestCheckResourceAttr("catalystcenter_aaa_settings.test", "client_aaa_primary_server_ip", "1.2.3.4"))
checks = append(checks, resource.TestCheckResourceAttr("catalystcenter_aaa_settings.test", "client_aaa_secondary_server_ip", "1.2.3.5"))

Expand Down Expand Up @@ -77,12 +79,6 @@ resource "catalystcenter_area" "test" {
func testAccCcAAASettingsConfig_minimum() string {
config := `resource "catalystcenter_aaa_settings" "test" {` + "\n"
config += ` site_id = catalystcenter_area.test.id` + "\n"
config += ` network_aaa_server_type = "AAA"` + "\n"
config += ` network_aaa_protocol = "RADIUS"` + "\n"
config += ` network_aaa_primary_server_ip = "1.2.3.4"` + "\n"
config += ` client_aaa_server_type = "AAA"` + "\n"
config += ` client_aaa_protocol = "RADIUS"` + "\n"
config += ` client_aaa_primary_server_ip = "1.2.3.4"` + "\n"
config += `}` + "\n"
return config
}
Expand All @@ -95,11 +91,13 @@ func testAccCcAAASettingsConfig_all() string {
config += ` site_id = catalystcenter_area.test.id` + "\n"
config += ` network_aaa_server_type = "AAA"` + "\n"
config += ` network_aaa_protocol = "RADIUS"` + "\n"
config += ` network_aaa_pan = "1.2.3.4"` + "\n"
config += ` network_aaa_primary_server_ip = "1.2.3.4"` + "\n"
config += ` network_aaa_secondary_server_ip = "1.2.3.5"` + "\n"
config += ` network_aaa_shared_secret = "Secret123"` + "\n"
config += ` client_aaa_server_type = "AAA"` + "\n"
config += ` client_aaa_protocol = "RADIUS"` + "\n"
config += ` client_aaa_pan = "1.2.3.4"` + "\n"
config += ` client_aaa_primary_server_ip = "1.2.3.4"` + "\n"
config += ` client_aaa_secondary_server_ip = "1.2.3.5"` + "\n"
config += ` client_aaa_shared_secret = "Secret123"` + "\n"
Expand Down

0 comments on commit 49057ba

Please sign in to comment.