From 0f4cc1a465dfb7b4aab5fb6d9f488451224381e4 Mon Sep 17 00:00:00 2001 From: akinross Date: Mon, 4 Nov 2024 10:21:43 +0100 Subject: [PATCH] [bugfix] Fix fex and micro_seg_vlan attributes in resource_mso_schema_site_anp_epg_bulk_staticport to be correctly set when index shift occur in the static_ports list --- ...mso_schema_site_anp_epg_bulk_staticport.go | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/mso/resource_mso_schema_site_anp_epg_bulk_staticport.go b/mso/resource_mso_schema_site_anp_epg_bulk_staticport.go index 3aba5575..4aa07a6e 100644 --- a/mso/resource_mso_schema_site_anp_epg_bulk_staticport.go +++ b/mso/resource_mso_schema_site_anp_epg_bulk_staticport.go @@ -77,9 +77,11 @@ func resourceMSOSchemaSiteAnpEpgBulkStaticPort() *schema.Resource { ValidateFunc: validation.StringLenBetween(1, 1000), }, "leaf": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + // Remove computed because when a user updates the list and causes index shifts + // the leaf state value will be used at the location of the list index when not provided in config. + // Computed: true, ValidateFunc: validation.StringLenBetween(1, 1000), }, "path": { @@ -94,27 +96,35 @@ func resourceMSOSchemaSiteAnpEpgBulkStaticPort() *schema.Resource { "deployment_immediacy": { Type: schema.TypeString, Optional: true, - Computed: true, + // Remove computed because when a user updates the list and causes index shifts + // the deployment_immediacy state value will be used at the location of the list index when not provided in config. + // Computed: true, ValidateFunc: validation.StringInSlice([]string{ "immediate", "lazy", }, false), }, "fex": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + // Remove computed because when a user updates the list and causes index shifts + // the fex state value will be used at the location of the list index when not provided in config. + // Computed: true, ValidateFunc: validation.StringIsNotEmpty, }, "micro_seg_vlan": { Type: schema.TypeInt, Optional: true, - Computed: true, + // Remove computed because when a user updates the list and causes index shifts + // the micro_seg_vlan state value will be used at the location of the list index when not provided in config. + // Computed: true, }, "mode": { Type: schema.TypeString, Optional: true, - Computed: true, + // Remove computed because when a user updates the list and causes index shifts + // the mode state value will be used at the location of the list index when not provided in config. + // Computed: true, ValidateFunc: validation.StringInSlice([]string{ "native", "regular",