terraform-provider-ovh icon indicating copy to clipboard operation
terraform-provider-ovh copied to clipboard

Add host, cluster_ca_certificate and token attributes of cloud_project_kube resource

Open FlorentPoinsaut opened this issue 2 years ago • 0 comments

Affected Resource

  • cloud_project_kube

Expected Behavior

The resource cloud_project_kube should have host, cluster_ca_certificate and token attributes to use the kubernetes provider without have to create a local file.

resource "ovh_cloud_project_kube" "k8s" {
  name    = "cluster"
  region  = "SBG"
  version = "1.23"
}

provider "kubernetes" {
  host                   = ovh_cloud_project_kube.k8s.apiserver_url
  cluster_ca_certificate = base64decode(ovh_cloud_project_kube.k8s.cluster_ca_cert)
  token                  = ovh_cloud_project_kube.k8s.token
}

Actual Behavior

We have to create a local file to use the kubernetes provider.

resource "ovh_cloud_project_kube" "k8s" {
  name    = "cluster"
  region  = "SBG"
  version = "1.23"
}

resource "local_sensitive_file" "kubeconfig" {
  content  = ovh_cloud_project_kube.k8s.kubeconfig
  filename = "${path.module}/.kube/kubeconfig"
}

provider "kubectl" {
  config_path = local_sensitive_file.kubeconfig.filename
}

Reference

  • Scaleway: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/k8s_cluster#attributes-reference

FlorentPoinsaut avatar Oct 13 '22 09:10 FlorentPoinsaut