diff options
| author | Mathieu Ouellet <mathieu.ouellet@energumen.io> | 2022-09-10 07:40:59 -0400 |
|---|---|---|
| committer | Mathieu Ouellet <mathieu.ouellet@energumen.io> | 2022-09-10 07:40:59 -0400 |
| commit | bd3642ef674669237c4b499ddfa222dcd0b10b6c (patch) | |
| tree | 85be5d8fcd0f960495daf664ae102fe81835a982 | |
| parent | 6ee1db81ea3e04fe32bf37b5659979bbfeee8a4e (diff) | |
remove hashing of kube_config value for k8s service endpoint resource
Signed-off-by: Mathieu Ouellet <mathieu.ouellet@energumen.io>
| -rw-r--r-- | azuredevops/internal/service/serviceendpoint/resource_serviceendpoint_kubernetes.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/azuredevops/internal/service/serviceendpoint/resource_serviceendpoint_kubernetes.go b/azuredevops/internal/service/serviceendpoint/resource_serviceendpoint_kubernetes.go index dbc2fce4..2d7fb78b 100644 --- a/azuredevops/internal/service/serviceendpoint/resource_serviceendpoint_kubernetes.go +++ b/azuredevops/internal/service/serviceendpoint/resource_serviceendpoint_kubernetes.go @@ -88,6 +88,8 @@ func makeSchemaKubeconfig(r *schema.Resource) { "kube_config": { Type: schema.TypeString, Required: true, + Sensitive: true, + DefaultFunc: schema.EnvDefaultFunc("AZDO_KUBERNETES_SERVICE_CONNECTION_KUBECONFIG", nil), Description: "Content of the kubeconfig file. The configuration information in your kubeconfig file allows Kubernetes clients to talk to your Kubernetes API servers. This file is used by kubectl and all supported Kubernetes clients.", }, "cluster_context": { @@ -103,10 +105,11 @@ func makeSchemaKubeconfig(r *schema.Resource) { }, }, } - makeProtectedSchema(resourceElemSchema, "kube_config", "AZDO_KUBERNETES_SERVICE_CONNECTION_KUBECONFIG", "Content of the kubeconfig file. The configuration information in your kubeconfig file allows Kubernetes clients to talk to your Kubernetes API servers. This file is used by kubectl and all supported Kubernetes clients.") r.Schema[resourceBlockKubeconfig] = &schema.Schema{ Type: schema.TypeSet, Optional: true, + MinItems: 1, + MaxItems: 1, Description: "'Kubeconfig'-type of configuration", Elem: resourceElemSchema, } @@ -285,13 +288,11 @@ func flattenServiceEndpointKubernetes(d *schema.ResourceData, serviceEndpoint *s kubeconfigSet := d.Get("kubeconfig").(*schema.Set).List() configuration := kubeconfigSet[0].(map[string]interface{}) - newHashKubeconfig, hashKeyKubeconfig := tfhelper.HelpFlattenSecretNested(d, resourceBlockKubeconfig, configuration, "kube_config") acceptUntrustedCerts, _ := strconv.ParseBool((*serviceEndpoint.Data)["acceptUntrustedCerts"]) kubeconfig = map[string]interface{}{ "kube_config": configuration["kube_config"].(string), "cluster_context": (*serviceEndpoint.Authorization.Parameters)["clusterContext"], "accept_untrusted_certs": acceptUntrustedCerts, - hashKeyKubeconfig: newHashKubeconfig, } kubeconfigList := make([]map[string]interface{}, 1) |
