Skip to content

Commit 80611a8

Browse files
Host output (#5)
* added cluster host to output * pull address straight from config object
1 parent 67e3aee commit 80611a8

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

minikube/resource_cluster.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, m interf
4747
return diag.FromErr(err)
4848
}
4949

50-
key, certificate, ca, err := getClusterOutputs(kc)
50+
key, certificate, ca, address, err := getClusterOutputs(kc)
5151
if err != nil {
5252
return diag.FromErr(err)
5353
}
@@ -56,7 +56,7 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, m interf
5656
d.Set("client_key", key)
5757
d.Set("client_certificate", certificate)
5858
d.Set("cluster_ca_certificate", ca)
59-
d.Set("host", "http://localhost:8080")
59+
d.Set("host", address)
6060
d.Set("cluster_name", kc.ClusterName)
6161

6262
diags = resourceClusterRead(ctx, d, m)
@@ -177,24 +177,27 @@ func setClusterState(d *schema.ResourceData, config *config.ClusterConfig, ports
177177
}
178178

179179
//getClusterOutputs return the cluster key, certificate and certificate authority from the provided kubeconfig
180-
func getClusterOutputs(kc *kubeconfig.Settings) (string, string, string, error) {
180+
func getClusterOutputs(kc *kubeconfig.Settings) (string, string, string, string, error) {
181181
key, err := state_utils.ReadContents(kc.ClientKey)
182182
if err != nil {
183-
return "", "", "", err
183+
return "", "", "", "", err
184184
}
185185

186186
certificate, err := state_utils.ReadContents(kc.ClientCertificate)
187187
if err != nil {
188-
return "", "", "", err
188+
return "", "", "", "", err
189189
}
190190

191191
ca, err := state_utils.ReadContents(kc.ClientCertificate)
192192
if err != nil {
193-
return "", "", "", err
193+
return "", "", "", "", err
194194
}
195195

196-
return key, certificate, ca, nil
196+
if err != nil {
197+
return "", "", "", "", err
198+
}
197199

200+
return key, certificate, ca, kc.ClusterServerAddress, nil
198201
}
199202

200203
func initialiseMinikubeClient(d *schema.ResourceData, m interface{}) (service.ClusterClient, error) {

0 commit comments

Comments
 (0)