Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kubernetes]: fixing issues related to some missing fields in config #1319

Merged
merged 2 commits into from
Jan 30, 2025

Conversation

loosla
Copy link
Contributor

@loosla loosla commented Jan 30, 2025

fixes #1318

Copy link
Member

@andrewsomething andrewsomething left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the correct solution.

The data source calls digitaloceanKubernetesClusterRead. So we need the data source schema to support all of the attributes present in the resource schema.

Something like this should do the trick:

diff --git a/digitalocean/kubernetes/datasource_kubernetes_cluster.go b/digitalocean/kubernetes/datasource_kubernetes_cluster.go
index 8c5e28bd..3183c804 100644
--- a/digitalocean/kubernetes/datasource_kubernetes_cluster.go
+++ b/digitalocean/kubernetes/datasource_kubernetes_cluster.go
@@ -30,6 +30,12 @@ func DataSourceDigitalOceanKubernetesCluster() *schema.Resource {
 				ValidateFunc: validation.NoZeroValues,
 			},
 
+			"kubeconfig_expire_seconds": {
+				Type:         schema.TypeInt,
+				Optional:     true,
+				ValidateFunc: validation.IntAtLeast(0),
+			},
+
 			"region": {
 				Type:     schema.TypeString,
 				Computed: true,
@@ -132,6 +138,26 @@ func DataSourceDigitalOceanKubernetesCluster() *schema.Resource {
 				Type:     schema.TypeString,
 				Computed: true,
 			},
+
+			controlPlaneFirewallField: {
+				Type:     schema.TypeList,
+				Computed: true,
+				Elem: &schema.Resource{
+					Schema: map[string]*schema.Schema{
+						"enabled": {
+							Type:     schema.TypeBool,
+							Computed: true,
+						},
+						"allowed_addresses": {
+							Type:     schema.TypeList,
+							Computed: true,
+							Elem: &schema.Schema{
+								Type: schema.TypeString,
+							},
+						},
+					},
+				},
+			},
 		},
 	}
 }

Copy link
Member

@andrewsomething andrewsomething left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM

@loosla loosla merged commit 389c702 into main Jan 30, 2025
3 checks passed
@loosla loosla deleted the alushnikova/kube-bug-fix branch January 30, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Retrieving data source from kubernetes cluster is no longer possible since update >= v2.48
2 participants