25
25
26
26
const (
27
27
controlPlaneFirewallField = "control_plane_firewall"
28
+ routingAgentField = "routing_agent"
28
29
)
29
30
30
31
func ResourceDigitalOceanKubernetesCluster () * schema.Resource {
@@ -240,6 +241,21 @@ func ResourceDigitalOceanKubernetesCluster() *schema.Resource {
240
241
},
241
242
},
242
243
},
244
+
245
+ routingAgentField : {
246
+ Type : schema .TypeList ,
247
+ Optional : true ,
248
+ Computed : true ,
249
+ MaxItems : 1 ,
250
+ Elem : & schema.Resource {
251
+ Schema : map [string ]* schema.Schema {
252
+ "enabled" : {
253
+ Type : schema .TypeBool ,
254
+ Required : true ,
255
+ },
256
+ },
257
+ },
258
+ },
243
259
},
244
260
245
261
Timeouts : & schema.ResourceTimeout {
@@ -372,10 +388,15 @@ func resourceDigitalOceanKubernetesClusterCreate(ctx context.Context, d *schema.
372
388
if controlPlaneFirewall , ok := d .GetOk (controlPlaneFirewallField ); ok {
373
389
opts .ControlPlaneFirewall = expandControlPlaneFirewallOpts (controlPlaneFirewall .([]interface {}))
374
390
}
391
+
375
392
if caConfig , ok := d .GetOk ("cluster_autoscaler_configuration" ); ok {
376
393
opts .ClusterAutoscalerConfiguration = expandCAConfigOpts (caConfig .([]interface {}))
377
394
}
378
395
396
+ if routingAgent , ok := d .GetOk (routingAgentField ); ok {
397
+ opts .RoutingAgent = expandRoutingAgentOpts (routingAgent .([]interface {}))
398
+ }
399
+
379
400
cluster , _ , err := client .Kubernetes .Create (context .Background (), opts )
380
401
if err != nil {
381
402
return diag .Errorf ("Error creating Kubernetes cluster: %s" , err )
@@ -443,6 +464,10 @@ func digitaloceanKubernetesClusterRead(
443
464
return diag .Errorf ("[DEBUG] Error setting %s - error: %#v" , controlPlaneFirewallField , err )
444
465
}
445
466
467
+ if err := d .Set (routingAgentField , flattenRoutingAgentOpts (cluster .RoutingAgent )); err != nil {
468
+ return diag .Errorf ("[DEBUG] Error setting %s - error: %#v" , routingAgentField , err )
469
+ }
470
+
446
471
if err := d .Set ("maintenance_policy" , flattenMaintPolicyOpts (cluster .MaintenancePolicy )); err != nil {
447
472
return diag .Errorf ("[DEBUG] Error setting maintenance_policy - error: %#v" , err )
448
473
}
@@ -505,7 +530,7 @@ func resourceDigitalOceanKubernetesClusterUpdate(ctx context.Context, d *schema.
505
530
client := meta .(* config.CombinedConfig ).GodoClient ()
506
531
507
532
// Figure out the changes and then call the appropriate API methods
508
- if d .HasChanges ("name" , "tags" , "auto_upgrade" , "surge_upgrade" , "maintenance_policy" , "ha" , controlPlaneFirewallField , "cluster_autoscaler_configuration" ) {
533
+ if d .HasChanges ("name" , "tags" , "auto_upgrade" , "surge_upgrade" , "maintenance_policy" , "ha" , controlPlaneFirewallField , "cluster_autoscaler_configuration" , routingAgentField ) {
509
534
510
535
opts := & godo.KubernetesClusterUpdateRequest {
511
536
Name : d .Get ("name" ).(string ),
@@ -514,6 +539,7 @@ func resourceDigitalOceanKubernetesClusterUpdate(ctx context.Context, d *schema.
514
539
SurgeUpgrade : d .Get ("surge_upgrade" ).(bool ),
515
540
HA : godo .PtrTo (d .Get ("ha" ).(bool )),
516
541
ControlPlaneFirewall : expandControlPlaneFirewallOpts (d .Get (controlPlaneFirewallField ).([]interface {})),
542
+ RoutingAgent : expandRoutingAgentOpts (d .Get (routingAgentField ).([]interface {})),
517
543
}
518
544
519
545
if maint , ok := d .GetOk ("maintenance_policy" ); ok {
0 commit comments