diff --git a/CHANGELOG.md b/CHANGELOG.md index cec08a68..b01083a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## 0.1.10 (unreleased) +- Add `fabric_device` resource and data source, this resource now only works with Catalyst Center version 2.3.7.5+ `/sda/fabricDevices` - Add `fabric_l3_handoff_ip_transit` resource and data source - Add `transitPeerNetworkId` as `id` to `transit_peer_network` resource - Add `anycast_gateway` resource and data source, this resource now only works with Catalyst Center version 2.3.7.5+ `/sda/anycastGateways` diff --git a/docs/data-sources/fabric_device.md b/docs/data-sources/fabric_device.md new file mode 100644 index 00000000..db05c843 --- /dev/null +++ b/docs/data-sources/fabric_device.md @@ -0,0 +1,39 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "catalystcenter_fabric_device Data Source - terraform-provider-catalystcenter" +subcategory: "SDA" +description: |- + This data source can read the Fabric Device. +--- + +# catalystcenter_fabric_device (Data Source) + +This data source can read the Fabric Device. + +## Example Usage + +```terraform +data "catalystcenter_fabric_device" "example" { + network_device_id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1" + fabric_id = "c4b85bb2-ce3f-4db9-a32b-e439a388ac2f" +} +``` + + +## Schema + +### Required + +- `fabric_id` (String) ID of the fabric site/zone of this fabric device +- `network_device_id` (String) Network device ID of the fabric device + +### Read-Only + +- `border_priority` (Number) Border priority of the fabric border device. A lower value indicates higher priority +- `border_types` (List of String) List of the border types of the fabric device. Allowed values are [LAYER_2, LAYER_3] +- `default_exit` (Boolean) Set this to make the fabric border device the gateway of last resort for this site. Any unknown traffic will be sent to this fabric border device from edge nodes +- `device_roles` (List of String) List of the roles of the fabric device. Allowed values are [CONTROL_PLANE_NODE, EDGE_NODE, BORDER_NODE] +- `id` (String) The id of the object +- `import_external_routes` (Boolean) Set this to import external routes from other routing protocols (such as BGP) to the fabric control plane +- `local_autonomous_system_number` (String) BGP Local autonomous system number of the fabric border device +- `prepend_autonomous_system_count` (Number) Prepend autonomous system count of the fabric border device diff --git a/docs/guides/changelog.md b/docs/guides/changelog.md index 6c127fb0..b3fd9c72 100644 --- a/docs/guides/changelog.md +++ b/docs/guides/changelog.md @@ -9,6 +9,7 @@ description: |- ## 0.1.10 (unreleased) +- Add `fabric_device` resource and data source, this resource now only works with Catalyst Center version 2.3.7.5+ `/sda/fabricDevices` - Add `fabric_l3_handoff_ip_transit` resource and data source - Add `transitPeerNetworkId` as `id` to `transit_peer_network` resource - Add `anycast_gateway` resource and data source, this resource now only works with Catalyst Center version 2.3.7.5+ `/sda/anycastGateways` diff --git a/docs/resources/fabric_device.md b/docs/resources/fabric_device.md new file mode 100644 index 00000000..21a96e4c --- /dev/null +++ b/docs/resources/fabric_device.md @@ -0,0 +1,60 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "catalystcenter_fabric_device Resource - terraform-provider-catalystcenter" +subcategory: "SDA" +description: |- + Manages Fabric Devices +--- + +# catalystcenter_fabric_device (Resource) + +Manages Fabric Devices + +## Example Usage + +```terraform +resource "catalystcenter_fabric_device" "example" { + network_device_id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1" + fabric_id = "c4b85bb2-ce3f-4db9-a32b-e439a388ac2f" + device_roles = ["CONTROL_PLANE_NODE"] + border_types = ["LAYER_3"] + local_autonomous_system_number = "65000" + default_exit = true + import_external_routes = false + border_priority = 5 + prepend_autonomous_system_count = 1 +} +``` + + +## Schema + +### Required + +- `device_roles` (List of String) List of the roles of the fabric device. Allowed values are [CONTROL_PLANE_NODE, EDGE_NODE, BORDER_NODE] +- `fabric_id` (String) ID of the fabric site/zone of this fabric device +- `network_device_id` (String) Network device ID of the fabric device + +### Optional + +- `border_priority` (Number) Border priority of the fabric border device. A lower value indicates higher priority + - Range: `1`-`9` + - Default value: `10` +- `border_types` (List of String) List of the border types of the fabric device. Allowed values are [LAYER_2, LAYER_3] +- `default_exit` (Boolean) Set this to make the fabric border device the gateway of last resort for this site. Any unknown traffic will be sent to this fabric border device from edge nodes +- `import_external_routes` (Boolean) Set this to import external routes from other routing protocols (such as BGP) to the fabric control plane +- `local_autonomous_system_number` (String) BGP Local autonomous system number of the fabric border device +- `prepend_autonomous_system_count` (Number) Prepend autonomous system count of the fabric border device + - Range: `1`-`10` + +### Read-Only + +- `id` (String) The id of the object + +## Import + +Import is supported using the following syntax: + +```shell +terraform import catalystcenter_fabric_device.example "," +``` diff --git a/examples/data-sources/catalystcenter_fabric_device/data-source.tf b/examples/data-sources/catalystcenter_fabric_device/data-source.tf new file mode 100644 index 00000000..fd501f24 --- /dev/null +++ b/examples/data-sources/catalystcenter_fabric_device/data-source.tf @@ -0,0 +1,4 @@ +data "catalystcenter_fabric_device" "example" { + network_device_id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1" + fabric_id = "c4b85bb2-ce3f-4db9-a32b-e439a388ac2f" +} diff --git a/examples/resources/catalystcenter_fabric_device/import.sh b/examples/resources/catalystcenter_fabric_device/import.sh new file mode 100644 index 00000000..4196a556 --- /dev/null +++ b/examples/resources/catalystcenter_fabric_device/import.sh @@ -0,0 +1 @@ +terraform import catalystcenter_fabric_device.example "," diff --git a/examples/resources/catalystcenter_fabric_device/resource.tf b/examples/resources/catalystcenter_fabric_device/resource.tf new file mode 100644 index 00000000..a5f1c1d8 --- /dev/null +++ b/examples/resources/catalystcenter_fabric_device/resource.tf @@ -0,0 +1,11 @@ +resource "catalystcenter_fabric_device" "example" { + network_device_id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1" + fabric_id = "c4b85bb2-ce3f-4db9-a32b-e439a388ac2f" + device_roles = ["CONTROL_PLANE_NODE"] + border_types = ["LAYER_3"] + local_autonomous_system_number = "65000" + default_exit = true + import_external_routes = false + border_priority = 5 + prepend_autonomous_system_count = 1 +} diff --git a/gen/definitions/fabric_device.yaml b/gen/definitions/fabric_device.yaml new file mode 100644 index 00000000..41b5c34d --- /dev/null +++ b/gen/definitions/fabric_device.yaml @@ -0,0 +1,96 @@ +--- +name: Fabric Device +rest_endpoint: /dna/intent/api/v1/sda/fabricDevices +res_description: Manages Fabric Devices +id_from_query_path: response.0 +id_from_query_path_attribute: id +put_id_include_path: 0.id +import_no_id: true +data_source_no_id: true +put_no_id: true +max_async_wait_time: 120 +doc_category: SDA +test_tags: [SDA] +attributes: + - model_name: networkDeviceId + query_param: true + requires_replace: true + data_path: '0' + response_data_path: response.0.networkDeviceId + mandatory: true + description: Network device ID of the fabric device + type: String + example: 5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1 + - model_name: fabricId + requires_replace: true + query_param: true + data_path: '0' + response_data_path: response.0.fabricId + type: String + mandatory: true + description: ID of the fabric site/zone of this fabric device + example: c4b85bb2-ce3f-4db9-a32b-e439a388ac2f + test_value: catalystcenter_fabric_site.test.id + - model_name: deviceRoles + requires_replace: true + data_path: '0' + response_data_path: response.0.deviceRoles + type: List + element_type: String + mandatory: true + description: List of the roles of the fabric device. Allowed values are [CONTROL_PLANE_NODE, EDGE_NODE, BORDER_NODE] + example: CONTROL_PLANE_NODE + - model_name: borderTypes + data_path: '0.borderDeviceSettings' + response_data_path: response.0.borderDeviceSettings.borderTypes + type: List + element_type: String + description: List of the border types of the fabric device. Allowed values are [LAYER_2, LAYER_3] + example: LAYER_3 + - model_name: localAutonomousSystemNumber + data_path: '0.borderDeviceSettings.layer3Settings' + response_data_path: response.0.borderDeviceSettings.layer3Settings.localAutonomousSystemNumber + type: String + description: BGP Local autonomous system number of the fabric border device + example: "65000" + - model_name: isDefaultExit + tf_name: default_exit + data_path: '0.borderDeviceSettings.layer3Settings' + response_data_path: response.0.borderDeviceSettings.layer3Settings.isDefaultExit + type: Bool + description: Set this to make the fabric border device the gateway of last resort for this site. Any unknown traffic will be sent to this fabric border device from edge nodes + example: true + - model_name: importExternalRoutes + data_path: '0.borderDeviceSettings.layer3Settings' + response_data_path: response.0.borderDeviceSettings.layer3Settings.importExternalRoutes + type: Bool + description: Set this to import external routes from other routing protocols (such as BGP) to the fabric control plane + example: false + - model_name: borderPriority + data_path: '0.borderDeviceSettings.layer3Settings' + response_data_path: response.0.borderDeviceSettings.layer3Settings.borderPriority + type: Int64 + min_int: 1 + max_int: 9 + description: Border priority of the fabric border device. A lower value indicates higher priority + example: 5 + default_value: 10 + - model_name: prependAutonomousSystemCount + data_path: '0.borderDeviceSettings.layer3Settings' + response_data_path: response.0.borderDeviceSettings.layer3Settings.prependAutonomousSystemCount + type: Int64 + description: Prepend autonomous system count of the fabric border device + example: 1 + min_int: 1 + max_int: 10 +test_prerequisites: | + resource "catalystcenter_area" "test" { + name = "Area1" + parent_name = "Global" + } + resource "catalystcenter_fabric_site" "test" { + site_id = catalystcenter_area.test.id + pub_sub_enabled = false + authentication_profile_name = "No Authentication" + depends_on = [catalystcenter_area.test] + } \ No newline at end of file diff --git a/internal/provider/data_source_catalystcenter_fabric_device.go b/internal/provider/data_source_catalystcenter_fabric_device.go new file mode 100644 index 00000000..336e4c48 --- /dev/null +++ b/internal/provider/data_source_catalystcenter_fabric_device.go @@ -0,0 +1,146 @@ +// Copyright © 2023 Cisco Systems, Inc. and its affiliates. +// All rights reserved. +// +// Licensed under the Mozilla Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://mozilla.org/MPL/2.0/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: MPL-2.0 + +package provider + +// Section below is generated&owned by "gen/generator.go". //template:begin imports +import ( + "context" + "fmt" + "net/url" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-log/tflog" + cc "github.com/netascode/go-catalystcenter" +) + +// End of section. //template:end imports + +// Section below is generated&owned by "gen/generator.go". //template:begin model + +// Ensure the implementation satisfies the expected interfaces. +var ( + _ datasource.DataSource = &FabricDeviceDataSource{} + _ datasource.DataSourceWithConfigure = &FabricDeviceDataSource{} +) + +func NewFabricDeviceDataSource() datasource.DataSource { + return &FabricDeviceDataSource{} +} + +type FabricDeviceDataSource struct { + client *cc.Client +} + +func (d *FabricDeviceDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_fabric_device" +} + +func (d *FabricDeviceDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "This data source can read the Fabric Device.", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + MarkdownDescription: "The id of the object", + Computed: true, + }, + "network_device_id": schema.StringAttribute{ + MarkdownDescription: "Network device ID of the fabric device", + Required: true, + }, + "fabric_id": schema.StringAttribute{ + MarkdownDescription: "ID of the fabric site/zone of this fabric device", + Required: true, + }, + "device_roles": schema.ListAttribute{ + MarkdownDescription: "List of the roles of the fabric device. Allowed values are [CONTROL_PLANE_NODE, EDGE_NODE, BORDER_NODE]", + ElementType: types.StringType, + Computed: true, + }, + "border_types": schema.ListAttribute{ + MarkdownDescription: "List of the border types of the fabric device. Allowed values are [LAYER_2, LAYER_3]", + ElementType: types.StringType, + Computed: true, + }, + "local_autonomous_system_number": schema.StringAttribute{ + MarkdownDescription: "BGP Local autonomous system number of the fabric border device", + Computed: true, + }, + "default_exit": schema.BoolAttribute{ + MarkdownDescription: "Set this to make the fabric border device the gateway of last resort for this site. Any unknown traffic will be sent to this fabric border device from edge nodes", + Computed: true, + }, + "import_external_routes": schema.BoolAttribute{ + MarkdownDescription: "Set this to import external routes from other routing protocols (such as BGP) to the fabric control plane", + Computed: true, + }, + "border_priority": schema.Int64Attribute{ + MarkdownDescription: "Border priority of the fabric border device. A lower value indicates higher priority", + Computed: true, + }, + "prepend_autonomous_system_count": schema.Int64Attribute{ + MarkdownDescription: "Prepend autonomous system count of the fabric border device", + Computed: true, + }, + }, + } +} + +func (d *FabricDeviceDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) { + if req.ProviderData == nil { + return + } + + d.client = req.ProviderData.(*CcProviderData).Client +} + +// End of section. //template:end model + +// Section below is generated&owned by "gen/generator.go". //template:begin read +func (d *FabricDeviceDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + var config FabricDevice + + // Read config + diags := req.Config.Get(ctx, &config) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String())) + + params := "" + params += "?networkDeviceId=" + url.QueryEscape(config.NetworkDeviceId.ValueString()) + "&fabricId=" + url.QueryEscape(config.FabricId.ValueString()) + res, err := d.client.Get(config.getPath() + params) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err)) + return + } + + config.fromBody(ctx, res) + + tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Id.ValueString())) + + diags = resp.State.Set(ctx, &config) + resp.Diagnostics.Append(diags...) +} + +// End of section. //template:end read diff --git a/internal/provider/data_source_catalystcenter_fabric_device_test.go b/internal/provider/data_source_catalystcenter_fabric_device_test.go new file mode 100644 index 00000000..8260e73f --- /dev/null +++ b/internal/provider/data_source_catalystcenter_fabric_device_test.go @@ -0,0 +1,98 @@ +// Copyright © 2023 Cisco Systems, Inc. and its affiliates. +// All rights reserved. +// +// Licensed under the Mozilla Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://mozilla.org/MPL/2.0/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: MPL-2.0 + +package provider + +// Section below is generated&owned by "gen/generator.go". //template:begin imports +import ( + "os" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +// End of section. //template:end imports + +// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource +func TestAccDataSourceCcFabricDevice(t *testing.T) { + if os.Getenv("SDA") == "" { + t.Skip("skipping test, set environment variable SDA") + } + var checks []resource.TestCheckFunc + checks = append(checks, resource.TestCheckResourceAttr("data.catalystcenter_fabric_device.test", "network_device_id", "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1")) + checks = append(checks, resource.TestCheckResourceAttr("data.catalystcenter_fabric_device.test", "device_roles.0", "CONTROL_PLANE_NODE")) + checks = append(checks, resource.TestCheckResourceAttr("data.catalystcenter_fabric_device.test", "border_types.0", "LAYER_3")) + checks = append(checks, resource.TestCheckResourceAttr("data.catalystcenter_fabric_device.test", "local_autonomous_system_number", "65000")) + checks = append(checks, resource.TestCheckResourceAttr("data.catalystcenter_fabric_device.test", "default_exit", "true")) + checks = append(checks, resource.TestCheckResourceAttr("data.catalystcenter_fabric_device.test", "import_external_routes", "false")) + checks = append(checks, resource.TestCheckResourceAttr("data.catalystcenter_fabric_device.test", "border_priority", "5")) + checks = append(checks, resource.TestCheckResourceAttr("data.catalystcenter_fabric_device.test", "prepend_autonomous_system_count", "1")) + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceCcFabricDevicePrerequisitesConfig + testAccDataSourceCcFabricDeviceConfig(), + Check: resource.ComposeTestCheckFunc(checks...), + }, + }, + }) +} + +// End of section. //template:end testAccDataSource + +// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites +const testAccDataSourceCcFabricDevicePrerequisitesConfig = ` +resource "catalystcenter_area" "test" { + name = "Area1" + parent_name = "Global" +} +resource "catalystcenter_fabric_site" "test" { + site_id = catalystcenter_area.test.id + pub_sub_enabled = false + authentication_profile_name = "No Authentication" + depends_on = [catalystcenter_area.test] +} +` + +// End of section. //template:end testPrerequisites + +// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig +func testAccDataSourceCcFabricDeviceConfig() string { + config := `resource "catalystcenter_fabric_device" "test" {` + "\n" + config += ` network_device_id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1"` + "\n" + config += ` fabric_id = catalystcenter_fabric_site.test.id` + "\n" + config += ` device_roles = ["CONTROL_PLANE_NODE"]` + "\n" + config += ` border_types = ["LAYER_3"]` + "\n" + config += ` local_autonomous_system_number = "65000"` + "\n" + config += ` default_exit = true` + "\n" + config += ` import_external_routes = false` + "\n" + config += ` border_priority = 5` + "\n" + config += ` prepend_autonomous_system_count = 1` + "\n" + config += `}` + "\n" + + config += ` + data "catalystcenter_fabric_device" "test" { + id = catalystcenter_fabric_device.test.id + network_device_id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1" + fabric_id = catalystcenter_fabric_site.test.id + } + ` + return config +} + +// End of section. //template:end testAccDataSourceConfig diff --git a/internal/provider/model_catalystcenter_fabric_device.go b/internal/provider/model_catalystcenter_fabric_device.go new file mode 100644 index 00000000..5544a987 --- /dev/null +++ b/internal/provider/model_catalystcenter_fabric_device.go @@ -0,0 +1,238 @@ +// Copyright © 2023 Cisco Systems, Inc. and its affiliates. +// All rights reserved. +// +// Licensed under the Mozilla Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://mozilla.org/MPL/2.0/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: MPL-2.0 + +package provider + +// Section below is generated&owned by "gen/generator.go". //template:begin imports +import ( + "context" + + "github.com/CiscoDevNet/terraform-provider-catalystcenter/internal/provider/helpers" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/tidwall/gjson" + "github.com/tidwall/sjson" +) + +// End of section. //template:end imports + +// Section below is generated&owned by "gen/generator.go". //template:begin types +type FabricDevice struct { + Id types.String `tfsdk:"id"` + NetworkDeviceId types.String `tfsdk:"network_device_id"` + FabricId types.String `tfsdk:"fabric_id"` + DeviceRoles types.List `tfsdk:"device_roles"` + BorderTypes types.List `tfsdk:"border_types"` + LocalAutonomousSystemNumber types.String `tfsdk:"local_autonomous_system_number"` + DefaultExit types.Bool `tfsdk:"default_exit"` + ImportExternalRoutes types.Bool `tfsdk:"import_external_routes"` + BorderPriority types.Int64 `tfsdk:"border_priority"` + PrependAutonomousSystemCount types.Int64 `tfsdk:"prepend_autonomous_system_count"` +} + +// End of section. //template:end types + +// Section below is generated&owned by "gen/generator.go". //template:begin getPath +func (data FabricDevice) getPath() string { + return "/dna/intent/api/v1/sda/fabricDevices" +} + +// End of section. //template:end getPath + +// Section below is generated&owned by "gen/generator.go". //template:begin getPathDelete + +// End of section. //template:end getPathDelete + +// Section below is generated&owned by "gen/generator.go". //template:begin toBody +func (data FabricDevice) toBody(ctx context.Context, state FabricDevice) string { + body := "" + put := false + if state.Id.ValueString() != "" { + put = true + body, _ = sjson.Set(body, "0.id", state.Id.ValueString()) + } + _ = put + if !data.NetworkDeviceId.IsNull() { + body, _ = sjson.Set(body, "0.networkDeviceId", data.NetworkDeviceId.ValueString()) + } + if !data.FabricId.IsNull() { + body, _ = sjson.Set(body, "0.fabricId", data.FabricId.ValueString()) + } + if !data.DeviceRoles.IsNull() { + var values []string + data.DeviceRoles.ElementsAs(ctx, &values, false) + body, _ = sjson.Set(body, "0.deviceRoles", values) + } + if !data.BorderTypes.IsNull() { + var values []string + data.BorderTypes.ElementsAs(ctx, &values, false) + body, _ = sjson.Set(body, "0.borderDeviceSettings.borderTypes", values) + } + if !data.LocalAutonomousSystemNumber.IsNull() { + body, _ = sjson.Set(body, "0.borderDeviceSettings.layer3Settings.localAutonomousSystemNumber", data.LocalAutonomousSystemNumber.ValueString()) + } + if !data.DefaultExit.IsNull() { + body, _ = sjson.Set(body, "0.borderDeviceSettings.layer3Settings.isDefaultExit", data.DefaultExit.ValueBool()) + } + if !data.ImportExternalRoutes.IsNull() { + body, _ = sjson.Set(body, "0.borderDeviceSettings.layer3Settings.importExternalRoutes", data.ImportExternalRoutes.ValueBool()) + } + if !data.BorderPriority.IsNull() { + body, _ = sjson.Set(body, "0.borderDeviceSettings.layer3Settings.borderPriority", data.BorderPriority.ValueInt64()) + } + if !data.PrependAutonomousSystemCount.IsNull() { + body, _ = sjson.Set(body, "0.borderDeviceSettings.layer3Settings.prependAutonomousSystemCount", data.PrependAutonomousSystemCount.ValueInt64()) + } + return body +} + +// End of section. //template:end toBody + +// Section below is generated&owned by "gen/generator.go". //template:begin fromBody +func (data *FabricDevice) fromBody(ctx context.Context, res gjson.Result) { + // Retrieve the 'id' attribute, if Data Source doesn't require id + if value := res.Get("response.0.id"); value.Exists() { + data.Id = types.StringValue(value.String()) + } else { + data.Id = types.StringNull() + } + if value := res.Get("response.0.networkDeviceId"); value.Exists() { + data.NetworkDeviceId = types.StringValue(value.String()) + } else { + data.NetworkDeviceId = types.StringNull() + } + if value := res.Get("response.0.fabricId"); value.Exists() { + data.FabricId = types.StringValue(value.String()) + } else { + data.FabricId = types.StringNull() + } + if value := res.Get("response.0.deviceRoles"); value.Exists() && len(value.Array()) > 0 { + data.DeviceRoles = helpers.GetStringList(value.Array()) + } else { + data.DeviceRoles = types.ListNull(types.StringType) + } + if value := res.Get("response.0.borderDeviceSettings.borderTypes"); value.Exists() && len(value.Array()) > 0 { + data.BorderTypes = helpers.GetStringList(value.Array()) + } else { + data.BorderTypes = types.ListNull(types.StringType) + } + if value := res.Get("response.0.borderDeviceSettings.layer3Settings.localAutonomousSystemNumber"); value.Exists() { + data.LocalAutonomousSystemNumber = types.StringValue(value.String()) + } else { + data.LocalAutonomousSystemNumber = types.StringNull() + } + if value := res.Get("response.0.borderDeviceSettings.layer3Settings.isDefaultExit"); value.Exists() { + data.DefaultExit = types.BoolValue(value.Bool()) + } else { + data.DefaultExit = types.BoolNull() + } + if value := res.Get("response.0.borderDeviceSettings.layer3Settings.importExternalRoutes"); value.Exists() { + data.ImportExternalRoutes = types.BoolValue(value.Bool()) + } else { + data.ImportExternalRoutes = types.BoolNull() + } + if value := res.Get("response.0.borderDeviceSettings.layer3Settings.borderPriority"); value.Exists() { + data.BorderPriority = types.Int64Value(value.Int()) + } else { + data.BorderPriority = types.Int64Value(10) + } + if value := res.Get("response.0.borderDeviceSettings.layer3Settings.prependAutonomousSystemCount"); value.Exists() { + data.PrependAutonomousSystemCount = types.Int64Value(value.Int()) + } else { + data.PrependAutonomousSystemCount = types.Int64Null() + } +} + +// End of section. //template:end fromBody + +// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody +func (data *FabricDevice) updateFromBody(ctx context.Context, res gjson.Result) { + if value := res.Get("response.0.networkDeviceId"); value.Exists() && !data.NetworkDeviceId.IsNull() { + data.NetworkDeviceId = types.StringValue(value.String()) + } else { + data.NetworkDeviceId = types.StringNull() + } + if value := res.Get("response.0.fabricId"); value.Exists() && !data.FabricId.IsNull() { + data.FabricId = types.StringValue(value.String()) + } else { + data.FabricId = types.StringNull() + } + if value := res.Get("response.0.deviceRoles"); value.Exists() && !data.DeviceRoles.IsNull() { + data.DeviceRoles = helpers.GetStringList(value.Array()) + } else { + data.DeviceRoles = types.ListNull(types.StringType) + } + if value := res.Get("response.0.borderDeviceSettings.borderTypes"); value.Exists() && !data.BorderTypes.IsNull() { + data.BorderTypes = helpers.GetStringList(value.Array()) + } else { + data.BorderTypes = types.ListNull(types.StringType) + } + if value := res.Get("response.0.borderDeviceSettings.layer3Settings.localAutonomousSystemNumber"); value.Exists() && !data.LocalAutonomousSystemNumber.IsNull() { + data.LocalAutonomousSystemNumber = types.StringValue(value.String()) + } else { + data.LocalAutonomousSystemNumber = types.StringNull() + } + if value := res.Get("response.0.borderDeviceSettings.layer3Settings.isDefaultExit"); value.Exists() && !data.DefaultExit.IsNull() { + data.DefaultExit = types.BoolValue(value.Bool()) + } else { + data.DefaultExit = types.BoolNull() + } + if value := res.Get("response.0.borderDeviceSettings.layer3Settings.importExternalRoutes"); value.Exists() && !data.ImportExternalRoutes.IsNull() { + data.ImportExternalRoutes = types.BoolValue(value.Bool()) + } else { + data.ImportExternalRoutes = types.BoolNull() + } + if value := res.Get("response.0.borderDeviceSettings.layer3Settings.borderPriority"); value.Exists() && !data.BorderPriority.IsNull() { + data.BorderPriority = types.Int64Value(value.Int()) + } else if data.BorderPriority.ValueInt64() != 10 { + data.BorderPriority = types.Int64Null() + } + if value := res.Get("response.0.borderDeviceSettings.layer3Settings.prependAutonomousSystemCount"); value.Exists() && !data.PrependAutonomousSystemCount.IsNull() { + data.PrependAutonomousSystemCount = types.Int64Value(value.Int()) + } else { + data.PrependAutonomousSystemCount = types.Int64Null() + } +} + +// End of section. //template:end updateFromBody + +// Section below is generated&owned by "gen/generator.go". //template:begin isNull +func (data *FabricDevice) isNull(ctx context.Context, res gjson.Result) bool { + if !data.DeviceRoles.IsNull() { + return false + } + if !data.BorderTypes.IsNull() { + return false + } + if !data.LocalAutonomousSystemNumber.IsNull() { + return false + } + if !data.DefaultExit.IsNull() { + return false + } + if !data.ImportExternalRoutes.IsNull() { + return false + } + if !data.BorderPriority.IsNull() { + return false + } + if !data.PrependAutonomousSystemCount.IsNull() { + return false + } + return true +} + +// End of section. //template:end isNull diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 636d9aae..95bf6933 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -254,6 +254,7 @@ func (p *CcProvider) Resources(ctx context.Context) []func() resource.Resource { NewDeviceRoleResource, NewDiscoveryResource, NewFabricAuthenticationProfileResource, + NewFabricDeviceResource, NewFabricL3HandoffIPTransitResource, NewFabricSiteResource, NewFabricVirtualNetworkResource, @@ -300,6 +301,7 @@ func (p *CcProvider) DataSources(ctx context.Context) []func() datasource.DataSo NewDeviceDetailDataSource, NewDiscoveryDataSource, NewFabricAuthenticationProfileDataSource, + NewFabricDeviceDataSource, NewFabricL3HandoffIPTransitDataSource, NewFabricSiteDataSource, NewFabricVirtualNetworkDataSource, diff --git a/internal/provider/resource_catalystcenter_fabric_device.go b/internal/provider/resource_catalystcenter_fabric_device.go new file mode 100644 index 00000000..a6b7c212 --- /dev/null +++ b/internal/provider/resource_catalystcenter_fabric_device.go @@ -0,0 +1,297 @@ +// Copyright © 2023 Cisco Systems, Inc. and its affiliates. +// All rights reserved. +// +// Licensed under the Mozilla Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://mozilla.org/MPL/2.0/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: MPL-2.0 + +package provider + +// Section below is generated&owned by "gen/generator.go". //template:begin imports +import ( + "context" + "fmt" + "net/url" + "strings" + + "github.com/CiscoDevNet/terraform-provider-catalystcenter/internal/provider/helpers" + "github.com/hashicorp/terraform-plugin-framework-validators/int64validator" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/int64default" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-log/tflog" + cc "github.com/netascode/go-catalystcenter" +) + +// End of section. //template:end imports + +// Section below is generated&owned by "gen/generator.go". //template:begin model + +// Ensure provider defined types fully satisfy framework interfaces +var _ resource.Resource = &FabricDeviceResource{} +var _ resource.ResourceWithImportState = &FabricDeviceResource{} + +func NewFabricDeviceResource() resource.Resource { + return &FabricDeviceResource{} +} + +type FabricDeviceResource struct { + client *cc.Client +} + +func (r *FabricDeviceResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_fabric_device" +} + +func (r *FabricDeviceResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: helpers.NewAttributeDescription("Manages Fabric Devices").String, + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + MarkdownDescription: "The id of the object", + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "network_device_id": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Network device ID of the fabric device").String, + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, + }, + "fabric_id": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("ID of the fabric site/zone of this fabric device").String, + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, + }, + "device_roles": schema.ListAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("List of the roles of the fabric device. Allowed values are [CONTROL_PLANE_NODE, EDGE_NODE, BORDER_NODE]").String, + ElementType: types.StringType, + Required: true, + PlanModifiers: []planmodifier.List{ + listplanmodifier.RequiresReplace(), + }, + }, + "border_types": schema.ListAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("List of the border types of the fabric device. Allowed values are [LAYER_2, LAYER_3]").String, + ElementType: types.StringType, + Optional: true, + }, + "local_autonomous_system_number": schema.StringAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("BGP Local autonomous system number of the fabric border device").String, + Optional: true, + }, + "default_exit": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Set this to make the fabric border device the gateway of last resort for this site. Any unknown traffic will be sent to this fabric border device from edge nodes").String, + Optional: true, + }, + "import_external_routes": schema.BoolAttribute{ + MarkdownDescription: helpers.NewAttributeDescription("Set this to import external routes from other routing protocols (such as BGP) to the fabric control plane").String, + Optional: true, + }, + "border_priority": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("Border priority of the fabric border device. A lower value indicates higher priority").AddIntegerRangeDescription(1, 9).AddDefaultValueDescription("10").String, + Optional: true, + Computed: true, + Validators: []validator.Int64{ + int64validator.Between(1, 9), + }, + Default: int64default.StaticInt64(10), + }, + "prepend_autonomous_system_count": schema.Int64Attribute{ + MarkdownDescription: helpers.NewAttributeDescription("Prepend autonomous system count of the fabric border device").AddIntegerRangeDescription(1, 10).String, + Optional: true, + Validators: []validator.Int64{ + int64validator.Between(1, 10), + }, + }, + }, + } +} + +func (r *FabricDeviceResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) { + if req.ProviderData == nil { + return + } + + r.client = req.ProviderData.(*CcProviderData).Client +} + +// End of section. //template:end model + +// Section below is generated&owned by "gen/generator.go". //template:begin create +func (r *FabricDeviceResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + var plan FabricDevice + + // Read plan + diags := req.Plan.Get(ctx, &plan) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + + // Create object + body := plan.toBody(ctx, FabricDevice{}) + + params := "" + res, err := r.client.Post(plan.getPath()+params, body, func(r *cc.Req) { r.MaxAsyncWaitTime = 120 }) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String())) + return + } + params = "" + params += "?networkDeviceId=" + url.QueryEscape(plan.NetworkDeviceId.ValueString()) + "&fabricId=" + url.QueryEscape(plan.FabricId.ValueString()) + res, err = r.client.Get(plan.getPath() + params) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String())) + return + } + plan.Id = types.StringValue(res.Get("response.0.id").String()) + + tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Id.ValueString())) + + diags = resp.State.Set(ctx, &plan) + resp.Diagnostics.Append(diags...) +} + +// End of section. //template:end create + +// Section below is generated&owned by "gen/generator.go". //template:begin read +func (r *FabricDeviceResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + var state FabricDevice + + // Read state + diags := req.State.Get(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Id.String())) + + params := "" + params += "?networkDeviceId=" + url.QueryEscape(state.NetworkDeviceId.ValueString()) + "&fabricId=" + url.QueryEscape(state.FabricId.ValueString()) + res, err := r.client.Get(state.getPath() + params) + if err != nil && strings.Contains(err.Error(), "StatusCode 404") { + resp.State.RemoveResource(ctx) + return + } else if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String())) + return + } + + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) + + diags = resp.State.Set(ctx, &state) + resp.Diagnostics.Append(diags...) +} + +// End of section. //template:end read + +// Section below is generated&owned by "gen/generator.go". //template:begin update +func (r *FabricDeviceResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + var plan, state FabricDevice + + // Read plan + diags := req.Plan.Get(ctx, &plan) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + // Read state + diags = req.State.Get(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Id.ValueString())) + + body := plan.toBody(ctx, state) + params := "" + res, err := r.client.Put(plan.getPath()+params, body, func(r *cc.Req) { r.MaxAsyncWaitTime = 120 }) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Id.ValueString())) + + diags = resp.State.Set(ctx, &plan) + resp.Diagnostics.Append(diags...) +} + +// End of section. //template:end update + +// Section below is generated&owned by "gen/generator.go". //template:begin delete +func (r *FabricDeviceResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + var state FabricDevice + + // Read state + diags := req.State.Get(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString())) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String())) + return + } + + tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) + + resp.State.RemoveResource(ctx) +} + +// End of section. //template:end delete + +// Section below is generated&owned by "gen/generator.go". //template:begin import +func (r *FabricDeviceResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + idParts := strings.Split(req.ID, ",") + + if len(idParts) != 2 || idParts[0] == "" || idParts[1] == "" { + resp.Diagnostics.AddError( + "Unexpected Import Identifier", + fmt.Sprintf("Expected import identifier with format: ,. Got: %q", req.ID), + ) + return + } + resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("network_device_id"), idParts[0])...) + resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("fabric_id"), idParts[1])...) +} + +// End of section. //template:end import diff --git a/internal/provider/resource_catalystcenter_fabric_device_test.go b/internal/provider/resource_catalystcenter_fabric_device_test.go new file mode 100644 index 00000000..a75d4d0c --- /dev/null +++ b/internal/provider/resource_catalystcenter_fabric_device_test.go @@ -0,0 +1,109 @@ +// Copyright © 2023 Cisco Systems, Inc. and its affiliates. +// All rights reserved. +// +// Licensed under the Mozilla Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://mozilla.org/MPL/2.0/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: MPL-2.0 + +package provider + +// Section below is generated&owned by "gen/generator.go". //template:begin imports +import ( + "os" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +// End of section. //template:end imports + +// Section below is generated&owned by "gen/generator.go". //template:begin testAcc +func TestAccCcFabricDevice(t *testing.T) { + if os.Getenv("SDA") == "" { + t.Skip("skipping test, set environment variable SDA") + } + var checks []resource.TestCheckFunc + checks = append(checks, resource.TestCheckResourceAttr("catalystcenter_fabric_device.test", "network_device_id", "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1")) + checks = append(checks, resource.TestCheckResourceAttr("catalystcenter_fabric_device.test", "device_roles.0", "CONTROL_PLANE_NODE")) + checks = append(checks, resource.TestCheckResourceAttr("catalystcenter_fabric_device.test", "border_types.0", "LAYER_3")) + checks = append(checks, resource.TestCheckResourceAttr("catalystcenter_fabric_device.test", "local_autonomous_system_number", "65000")) + checks = append(checks, resource.TestCheckResourceAttr("catalystcenter_fabric_device.test", "default_exit", "true")) + checks = append(checks, resource.TestCheckResourceAttr("catalystcenter_fabric_device.test", "import_external_routes", "false")) + checks = append(checks, resource.TestCheckResourceAttr("catalystcenter_fabric_device.test", "border_priority", "5")) + checks = append(checks, resource.TestCheckResourceAttr("catalystcenter_fabric_device.test", "prepend_autonomous_system_count", "1")) + + var steps []resource.TestStep + if os.Getenv("SKIP_MINIMUM_TEST") == "" { + steps = append(steps, resource.TestStep{ + Config: testAccCcFabricDevicePrerequisitesConfig + testAccCcFabricDeviceConfig_minimum(), + }) + } + steps = append(steps, resource.TestStep{ + Config: testAccCcFabricDevicePrerequisitesConfig + testAccCcFabricDeviceConfig_all(), + Check: resource.ComposeTestCheckFunc(checks...), + }) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: steps, + }) +} + +// End of section. //template:end testAcc + +// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites +const testAccCcFabricDevicePrerequisitesConfig = ` +resource "catalystcenter_area" "test" { + name = "Area1" + parent_name = "Global" +} +resource "catalystcenter_fabric_site" "test" { + site_id = catalystcenter_area.test.id + pub_sub_enabled = false + authentication_profile_name = "No Authentication" + depends_on = [catalystcenter_area.test] +} +` + +// End of section. //template:end testPrerequisites + +// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimal +func testAccCcFabricDeviceConfig_minimum() string { + config := `resource "catalystcenter_fabric_device" "test" {` + "\n" + config += ` network_device_id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1"` + "\n" + config += ` fabric_id = catalystcenter_fabric_site.test.id` + "\n" + config += ` device_roles = ["CONTROL_PLANE_NODE"]` + "\n" + config += `}` + "\n" + return config +} + +// End of section. //template:end testAccConfigMinimal + +// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll +func testAccCcFabricDeviceConfig_all() string { + config := `resource "catalystcenter_fabric_device" "test" {` + "\n" + config += ` network_device_id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1"` + "\n" + config += ` fabric_id = catalystcenter_fabric_site.test.id` + "\n" + config += ` device_roles = ["CONTROL_PLANE_NODE"]` + "\n" + config += ` border_types = ["LAYER_3"]` + "\n" + config += ` local_autonomous_system_number = "65000"` + "\n" + config += ` default_exit = true` + "\n" + config += ` import_external_routes = false` + "\n" + config += ` border_priority = 5` + "\n" + config += ` prepend_autonomous_system_count = 1` + "\n" + config += `}` + "\n" + return config +} + +// End of section. //template:end testAccConfigAll diff --git a/templates/guides/changelog.md.tmpl b/templates/guides/changelog.md.tmpl index 6c127fb0..b3fd9c72 100644 --- a/templates/guides/changelog.md.tmpl +++ b/templates/guides/changelog.md.tmpl @@ -9,6 +9,7 @@ description: |- ## 0.1.10 (unreleased) +- Add `fabric_device` resource and data source, this resource now only works with Catalyst Center version 2.3.7.5+ `/sda/fabricDevices` - Add `fabric_l3_handoff_ip_transit` resource and data source - Add `transitPeerNetworkId` as `id` to `transit_peer_network` resource - Add `anycast_gateway` resource and data source, this resource now only works with Catalyst Center version 2.3.7.5+ `/sda/anycastGateways`