diff --git a/docs/resources/aaa_settings.md b/docs/resources/aaa_settings.md index dc525c66..9fd49ed8 100644 --- a/docs/resources/aaa_settings.md +++ b/docs/resources/aaa_settings.md @@ -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" @@ -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 diff --git a/examples/resources/catalystcenter_aaa_settings/resource.tf b/examples/resources/catalystcenter_aaa_settings/resource.tf index d226c269..f8cb5109 100644 --- a/examples/resources/catalystcenter_aaa_settings/resource.tf +++ b/examples/resources/catalystcenter_aaa_settings/resource.tf @@ -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" diff --git a/gen/definitions/aaa_settings.yaml b/gen/definitions/aaa_settings.yaml index c5ce6a07..3d15d073 100644 --- a/gen/definitions/aaa_settings.yaml +++ b/gen/definitions/aaa_settings.yaml @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/internal/provider/data_source_catalystcenter_aaa_settings_test.go b/internal/provider/data_source_catalystcenter_aaa_settings_test.go index 28e35aa8..13ad30ea 100644 --- a/internal/provider/data_source_catalystcenter_aaa_settings_test.go +++ b/internal/provider/data_source_catalystcenter_aaa_settings_test.go @@ -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{ @@ -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" diff --git a/internal/provider/resource_catalystcenter_aaa_settings.go b/internal/provider/resource_catalystcenter_aaa_settings.go index aaa83990..8ca805a6 100644 --- a/internal/provider/resource_catalystcenter_aaa_settings.go +++ b/internal/provider/resource_catalystcenter_aaa_settings.go @@ -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"), }, @@ -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, @@ -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"), }, @@ -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, diff --git a/internal/provider/resource_catalystcenter_aaa_settings_test.go b/internal/provider/resource_catalystcenter_aaa_settings_test.go index 2ed94417..89c9b4dd 100644 --- a/internal/provider/resource_catalystcenter_aaa_settings_test.go +++ b/internal/provider/resource_catalystcenter_aaa_settings_test.go @@ -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")) @@ -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 } @@ -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"