@@ -7434,7 +7434,7 @@ func instanceUpdate(context context.Context, d *schema.ResourceData, meta interf
74347434
74357435 }
74367436
7437- if (d .HasChange (isInstanceName ) || d .HasChange ("availability" ) || d .HasChange ("confidential_compute_mode" ) || d .HasChange ("enable_secure_boot" )) && ! d .IsNewResource () {
7437+ if (d .HasChange (isInstanceName ) || d .HasChange ("availability" ) || d .HasChange ("availability_policy" ) || d . HasChange ( " confidential_compute_mode" ) || d .HasChange ("enable_secure_boot" )) && ! d .IsNewResource () {
74387438 restartNeeded := false
74397439 serverstopped := false
74407440 name := d .Get (isInstanceName ).(string )
@@ -7454,6 +7454,14 @@ func instanceUpdate(context context.Context, d *schema.ResourceData, meta interf
74547454 instanceCCMPatchModel .Availability = availability
74557455 restartNeeded = true
74567456 }
7457+ if d .HasChange ("availability_policy" ) {
7458+ availabilityPolicy , err := ResourceIBMIsInstanceMapToInstanceAvailabilityPolicyPatch (d .Get ("availability_policy.0" ).(map [string ]interface {}))
7459+ if err != nil {
7460+ return flex .DiscriminatedTerraformErrorf (err , err .Error (), "ibm_is_instance" , "update" , "parse-availability_policy" ).GetDiag ()
7461+ }
7462+ instanceCCMPatchModel .AvailabilityPolicy = availabilityPolicy
7463+ restartNeeded = true
7464+ }
74577465 if _ , ok := d .GetOkExists ("enable_secure_boot" ); ok && d .HasChange ("enable_secure_boot" ) {
74587466 instanceCCMPatchModel .EnableSecureBoot = core .BoolPtr (d .Get ("enable_secure_boot" ).(bool ))
74597467 }
@@ -9587,3 +9595,13 @@ func ResourceIBMIsInstanceMapToInstanceAvailabilityPolicyPrototype(modelMap map[
95879595 }
95889596 return model , nil
95899597}
9598+ func ResourceIBMIsInstanceMapToInstanceAvailabilityPolicyPatch (modelMap map [string ]interface {}) (* vpcv1.InstanceAvailabilityPolicyPatch , error ) {
9599+ model := & vpcv1.InstanceAvailabilityPolicyPatch {}
9600+ if modelMap ["host_failure" ] != nil && modelMap ["host_failure" ].(string ) != "" {
9601+ model .HostFailure = core .StringPtr (modelMap ["host_failure" ].(string ))
9602+ }
9603+ if modelMap ["preemption" ] != nil && modelMap ["preemption" ].(string ) != "" {
9604+ model .Preemption = core .StringPtr (modelMap ["preemption" ].(string ))
9605+ }
9606+ return model , nil
9607+ }
0 commit comments