@@ -570,41 +570,29 @@ func ResourceK8SClusterRead(ctx context.Context, d *schema.ResourceData, m inter
570
570
_ = d .Set ("open_id_connect_config" , clusterOpenIDConnectConfigFlatten (cluster ))
571
571
_ = d .Set ("auto_upgrade" , clusterAutoUpgradeFlatten (cluster ))
572
572
573
- var diags diag.Diagnostics
574
-
575
573
// private_network
576
- pnID := types .FlattenStringPtr (cluster .PrivateNetworkID )
577
- clusterType := d .Get ("type" ).(string )
578
- _ = d .Set ("private_network_id" , pnID )
579
-
580
- if pnID == "" && ! strings .HasPrefix (clusterType , "multicloud" ) {
581
- diags = append (diags , diag.Diagnostic {
582
- Severity : diag .Warning ,
583
- Summary : "Public clusters are deprecated" ,
584
- Detail : "Important: Harden your cluster's security by enabling a free Private Network ASAP. Full public clusters are deprecated and will reach End of Support in Q1 2024." ,
585
- })
586
- }
574
+ _ = d .Set ("private_network_id" , types .FlattenStringPtr (cluster .PrivateNetworkID ))
587
575
588
576
////
589
577
// Read kubeconfig
590
578
////
591
579
kubeconfig , err := flattenKubeconfig (ctx , k8sAPI , region , clusterID )
592
580
if err != nil {
593
581
if httperrors .Is403 (err ) {
594
- diags = append ( diags , diag.Diagnostic {
582
+ return diag. Diagnostics { diag.Diagnostic {
595
583
Severity : diag .Warning ,
596
584
Summary : "Cannot read kubeconfig: unauthorized" ,
597
585
Detail : "Got 403 while reading kubeconfig, please check your permissions" ,
598
586
AttributePath : cty .GetAttrPath ("kubeconfig" ),
599
- })
587
+ }}
600
588
}
601
- } else {
602
- diags = append ( diags , diag .FromErr (err ) ... )
589
+
590
+ return diag .FromErr (err )
603
591
}
604
592
605
593
_ = d .Set ("kubeconfig" , []map [string ]interface {}{kubeconfig })
606
594
607
- return diags
595
+ return nil
608
596
}
609
597
610
598
//gocyclo:ignore
0 commit comments