@@ -283,6 +283,15 @@ This number is on a scale from 0 (no utilization) to 100 (full utilization).`,
283
283
},
284
284
ExactlyOneOf : []string {"num_nodes" , "processing_units" , "autoscaling_config" },
285
285
},
286
+ "default_backup_schedule_type" : {
287
+ Type : schema .TypeString ,
288
+ Computed : true ,
289
+ Optional : true ,
290
+ ValidateFunc : verify .ValidateEnum ([]string {"NONE" , "AUTOMATIC" , "" }),
291
+ Description : `Controls the default backup behavior for new databases within the instance.
292
+ Note that 'AUTOMATIC' is not permitted for free instances, as backups and backup schedules are not allowed for free instances.
293
+ if unset or NONE, no default backup schedule will be created for new databases within the instance. Possible values: ["NONE", "AUTOMATIC"]` ,
294
+ },
286
295
"edition" : {
287
296
Type : schema .TypeString ,
288
297
Computed : true ,
@@ -403,6 +412,12 @@ func resourceSpannerInstanceCreate(d *schema.ResourceData, meta interface{}) err
403
412
} else if v , ok := d .GetOkExists ("edition" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (editionProp )) && (ok || ! reflect .DeepEqual (v , editionProp )) {
404
413
obj ["edition" ] = editionProp
405
414
}
415
+ defaultBackupScheduleTypeProp , err := expandSpannerInstanceDefaultBackupScheduleType (d .Get ("default_backup_schedule_type" ), d , config )
416
+ if err != nil {
417
+ return err
418
+ } else if v , ok := d .GetOkExists ("default_backup_schedule_type" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (defaultBackupScheduleTypeProp )) && (ok || ! reflect .DeepEqual (v , defaultBackupScheduleTypeProp )) {
419
+ obj ["defaultBackupScheduleType" ] = defaultBackupScheduleTypeProp
420
+ }
406
421
labelsProp , err := expandSpannerInstanceEffectiveLabels (d .Get ("effective_labels" ), d , config )
407
422
if err != nil {
408
423
return err
@@ -585,6 +600,9 @@ func resourceSpannerInstanceRead(d *schema.ResourceData, meta interface{}) error
585
600
if err := d .Set ("edition" , flattenSpannerInstanceEdition (res ["edition" ], d , config )); err != nil {
586
601
return fmt .Errorf ("Error reading Instance: %s" , err )
587
602
}
603
+ if err := d .Set ("default_backup_schedule_type" , flattenSpannerInstanceDefaultBackupScheduleType (res ["defaultBackupScheduleType" ], d , config )); err != nil {
604
+ return fmt .Errorf ("Error reading Instance: %s" , err )
605
+ }
588
606
if err := d .Set ("terraform_labels" , flattenSpannerInstanceTerraformLabels (res ["labels" ], d , config )); err != nil {
589
607
return fmt .Errorf ("Error reading Instance: %s" , err )
590
608
}
@@ -641,6 +659,12 @@ func resourceSpannerInstanceUpdate(d *schema.ResourceData, meta interface{}) err
641
659
} else if v , ok := d .GetOkExists ("edition" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , editionProp )) {
642
660
obj ["edition" ] = editionProp
643
661
}
662
+ defaultBackupScheduleTypeProp , err := expandSpannerInstanceDefaultBackupScheduleType (d .Get ("default_backup_schedule_type" ), d , config )
663
+ if err != nil {
664
+ return err
665
+ } else if v , ok := d .GetOkExists ("default_backup_schedule_type" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , defaultBackupScheduleTypeProp )) {
666
+ obj ["defaultBackupScheduleType" ] = defaultBackupScheduleTypeProp
667
+ }
644
668
labelsProp , err := expandSpannerInstanceEffectiveLabels (d .Get ("effective_labels" ), d , config )
645
669
if err != nil {
646
670
return err
@@ -1125,6 +1149,10 @@ func flattenSpannerInstanceEdition(v interface{}, d *schema.ResourceData, config
1125
1149
return v
1126
1150
}
1127
1151
1152
+ func flattenSpannerInstanceDefaultBackupScheduleType (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1153
+ return v
1154
+ }
1155
+
1128
1156
func flattenSpannerInstanceTerraformLabels (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1129
1157
if v == nil {
1130
1158
return v
@@ -1406,6 +1434,10 @@ func expandSpannerInstanceEdition(v interface{}, d tpgresource.TerraformResource
1406
1434
return v , nil
1407
1435
}
1408
1436
1437
+ func expandSpannerInstanceDefaultBackupScheduleType (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1438
+ return v , nil
1439
+ }
1440
+
1409
1441
func expandSpannerInstanceEffectiveLabels (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (map [string ]string , error ) {
1410
1442
if v == nil {
1411
1443
return map [string ]string {}, nil
@@ -1448,6 +1480,9 @@ func resourceSpannerInstanceUpdateEncoder(d *schema.ResourceData, meta interface
1448
1480
if d .HasChange ("edition" ) {
1449
1481
updateMask = append (updateMask , "edition" )
1450
1482
}
1483
+ if d .HasChange ("default_backup_schedule_type" ) {
1484
+ updateMask = append (updateMask , "defaultBackupScheduleType" )
1485
+ }
1451
1486
if d .HasChange ("num_nodes" ) {
1452
1487
updateMask = append (updateMask , "nodeCount" )
1453
1488
}
0 commit comments