Skip to content

Commit 025a80a

Browse files
fix: do not report diff on adminstate_config when in registered state (#50)
1 parent e5a7f57 commit 025a80a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

schemas/edgenode.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package schemas
55

66
import (
77
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
8+
"github.com/zededa/zedcloud-api/swagger_models"
89
)
910

1011
// Schema for swagger_models.GeoLocation
@@ -127,6 +128,14 @@ var EdgeNodeSchema = map[string]*schema.Schema{
127128
Optional: true,
128129
Description: "Administrative state of device. Required field. " +
129130
"Valid Values to configure: ADMIN_STATE_ACTIVE, ADMIN_STATE_INACTIVE",
131+
Default: swagger_models.AdminStateADMINSTATECREATED,
132+
DiffSuppressFunc: func(k, oldValue, newValue string, d *schema.ResourceData) bool {
133+
if oldValue == string(swagger_models.AdminStateADMINSTATEREGISTERED) &&
134+
newValue == string(swagger_models.AdminStateADMINSTATEACTIVE) {
135+
return true
136+
}
137+
return false
138+
},
130139
},
131140
"asset_id": {
132141
Type: schema.TypeString,

0 commit comments

Comments
 (0)