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

How to configure k8s username/password authentication #1260

Open
gsbraman opened this issue Oct 11, 2023 · 0 comments
Open

How to configure k8s username/password authentication #1260

gsbraman opened this issue Oct 11, 2023 · 0 comments
Labels

Comments

@gsbraman
Copy link

If you prefer, you can also ask your question in the Kubernetes community Slack channel #terraform-providers. (Sign up here)

Terraform version, Kubernetes provider version and Kubernetes version

Terraform version: 1.6.1 on linux_amd64
Helm Provider version: ~> 2.10
Kubernetes version: ~> 2.21

Terraform configuration

terraform {
  required_providers {
    kubernetes = {
      source  = "hashicorp/kubernetes"
      version = "~> 2.21"      
    }
    tls = {
      source  = "hashicorp/tls"
      version = "~> 4.0"
    }
    helm = {
      source  = "hashicorp/helm"
      version = "~> 2.10"  
    }
  }
 }


# +------------+
# | This works |
# +------------+

# provider "helm" {
#   kubernetes {
#     config_path = "~/.kube/config"
#   }
# }

# +--------------------------------------------------------------------------------------------------------+
# | This throws the follwong error when running terraform apply:                                           |
# | "Error: could not get apiVersions from Kubernetes: could not get apiVersions from Kubernetes: unknown" |
# +--------------------------------------------------------------------------------------------------------+

provider "helm" {  
 kubernetes {
   host     = "https://api.crc.testing:6443"
   username = "my_user"
   password = "my_password"   
   insecure = true
 }
}

resource "helm_release" "gitops" {
  name        = "gitops"
  chart       = "gitops"
  repository  = "."
  namespace   = "helm-gitops"
  max_history = 3
  create_namespace = true
  wait             = true
  reset_values     = true
}

Question

When running terraform apply using the username / password option, the following error is returned:

Error: could not get apiVersions from Kubernetes: could not get apiVersions from Kubernetes: unknown

│ with helm_release.gitops,
│ on main.tf line 43, in resource "helm_release" "gitops":
│ 43: resource "helm_release" "gitops" {

Is this the proper syntax?

Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant