@@ -40,8 +40,22 @@ var NotebooksInstanceProvidedScopes = []string{
4040 "https://www.googleapis.com/auth/userinfo.email" ,
4141}
4242
43+ var NotebooksInstanceProvidedTags = []string {
44+ "deeplearning-vm" ,
45+ "notebook-instance" ,
46+ }
47+
4348func NotebooksInstanceScopesDiffSuppress (_ , _ , _ string , d * schema.ResourceData ) bool {
44- old , new := d .GetChange ("service_account_scopes" )
49+ return NotebooksDiffSuppressTemplate ("service_account_scopes" , NotebooksInstanceProvidedScopes , d )
50+ }
51+
52+ func NotebooksInstanceTagsDiffSuppress (_ , _ , _ string , d * schema.ResourceData ) bool {
53+ return NotebooksDiffSuppressTemplate ("tags" , NotebooksInstanceProvidedTags , d )
54+ }
55+
56+ func NotebooksDiffSuppressTemplate (field string , defaults []string , d * schema.ResourceData ) bool {
57+ old , new := d .GetChange (field )
58+
4559 oldValue := old .([]interface {})
4660 newValue := new .([]interface {})
4761 oldValueList := []string {}
@@ -54,7 +68,7 @@ func NotebooksInstanceScopesDiffSuppress(_, _, _ string, d *schema.ResourceData)
5468 for _ , item := range newValue {
5569 newValueList = append (newValueList , item .(string ))
5670 }
57- newValueList = append (newValueList , NotebooksInstanceProvidedScopes ... )
71+ newValueList = append (newValueList , defaults ... )
5872
5973 sort .Strings (oldValueList )
6074 sort .Strings (newValueList )
@@ -469,11 +483,12 @@ Enabled by default.`,
469483Format: projects/{project_id}/regions/{region}/subnetworks/{subnetwork_id}` ,
470484 },
471485 "tags" : {
472- Type : schema .TypeList ,
473- Computed : true ,
474- Optional : true ,
475- ForceNew : true ,
476- Description : `The Compute Engine tags to add to instance.` ,
486+ Type : schema .TypeList ,
487+ Computed : true ,
488+ Optional : true ,
489+ ForceNew : true ,
490+ DiffSuppressFunc : NotebooksInstanceTagsDiffSuppress ,
491+ Description : `The Compute Engine tags to add to instance.` ,
477492 Elem : & schema.Schema {
478493 Type : schema .TypeString ,
479494 },
0 commit comments