Skip to content

Commit 362ef03

Browse files
committed
feat(k8s): remove warnings for missing pn
1 parent 526c83d commit 362ef03

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

internal/services/k8s/cluster.go

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -570,41 +570,28 @@ func ResourceK8SClusterRead(ctx context.Context, d *schema.ResourceData, m inter
570570
_ = d.Set("open_id_connect_config", clusterOpenIDConnectConfigFlatten(cluster))
571571
_ = d.Set("auto_upgrade", clusterAutoUpgradeFlatten(cluster))
572572

573-
var diags diag.Diagnostics
574-
575573
// 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))
587575

588576
////
589577
// Read kubeconfig
590578
////
591579
kubeconfig, err := flattenKubeconfig(ctx, k8sAPI, region, clusterID)
592580
if err != nil {
593581
if httperrors.Is403(err) {
594-
diags = append(diags, diag.Diagnostic{
582+
return diag.Diagnostics{diag.Diagnostic{
595583
Severity: diag.Warning,
596584
Summary: "Cannot read kubeconfig: unauthorized",
597585
Detail: "Got 403 while reading kubeconfig, please check your permissions",
598586
AttributePath: cty.GetAttrPath("kubeconfig"),
599-
})
587+
}}
588+
} else {
589+
return diag.FromErr(err)
600590
}
601-
} else {
602-
diags = append(diags, diag.FromErr(err)...)
603591
}
604-
605592
_ = d.Set("kubeconfig", []map[string]interface{}{kubeconfig})
606593

607-
return diags
594+
return nil
608595
}
609596

610597
//gocyclo:ignore

0 commit comments

Comments
 (0)