@@ -1106,6 +1106,33 @@ func resourceContainerClusterUpdate(d *schema.ResourceData, meta interface{}) er
1106
1106
d .SetPartial ("monitoring_service" )
1107
1107
}
1108
1108
1109
+ if d .HasChange ("logging_service" ) {
1110
+ logging := d .Get ("logging_service" ).(string )
1111
+
1112
+ req := & containerBeta.SetLoggingServiceRequest {
1113
+ LoggingService : logging ,
1114
+ }
1115
+ updateF := func () error {
1116
+ name := containerClusterFullName (project , location , clusterName )
1117
+ op , err := config .clientContainerBeta .Projects .Locations .Clusters .SetLogging (name , req ).Do ()
1118
+ if err != nil {
1119
+ return err
1120
+ }
1121
+
1122
+ // Wait until it's updated
1123
+ return containerSharedOperationWait (config , op , project , location , "updating GKE logging service" , timeoutInMinutes , 2 )
1124
+ }
1125
+
1126
+ // Call update serially.
1127
+ if err := lockedCall (lockKey , updateF ); err != nil {
1128
+ return err
1129
+ }
1130
+
1131
+ log .Printf ("[INFO] GKE cluster %s: logging service has been updated to %s" , d .Id (),
1132
+ logging )
1133
+ d .SetPartial ("logging_service" )
1134
+ }
1135
+
1109
1136
if d .HasChange ("network_policy" ) {
1110
1137
np := d .Get ("network_policy" )
1111
1138
req := & containerBeta.SetNetworkPolicyRequest {
@@ -1151,33 +1178,6 @@ func resourceContainerClusterUpdate(d *schema.ResourceData, meta interface{}) er
1151
1178
d .SetPartial ("node_pool" )
1152
1179
}
1153
1180
1154
- if d .HasChange ("logging_service" ) {
1155
- logging := d .Get ("logging_service" ).(string )
1156
-
1157
- req := & containerBeta.SetLoggingServiceRequest {
1158
- LoggingService : logging ,
1159
- }
1160
- updateF := func () error {
1161
- name := containerClusterFullName (project , location , clusterName )
1162
- op , err := config .clientContainerBeta .Projects .Locations .Clusters .SetLogging (name , req ).Do ()
1163
- if err != nil {
1164
- return err
1165
- }
1166
-
1167
- // Wait until it's updated
1168
- return containerSharedOperationWait (config , op , project , location , "updating GKE logging service" , timeoutInMinutes , 2 )
1169
- }
1170
-
1171
- // Call update serially.
1172
- if err := lockedCall (lockKey , updateF ); err != nil {
1173
- return err
1174
- }
1175
-
1176
- log .Printf ("[INFO] GKE cluster %s: logging service has been updated to %s" , d .Id (),
1177
- logging )
1178
- d .SetPartial ("logging_service" )
1179
- }
1180
-
1181
1181
if d .HasChange ("node_config" ) {
1182
1182
if d .HasChange ("node_config.0.image_type" ) {
1183
1183
it := d .Get ("node_config.0.image_type" ).(string )
0 commit comments