zhangtbj / terraform-dashboard

0 stars 1 forks source link

The backend "kubernetes" for terraform is namespaced #1

Open isaaguilar opened 2 years ago

isaaguilar commented 2 years ago

https://github.com/zhangtbj/terraform-dashboard/blob/5d0d91ac1c03d3544a216901a5919957e70e66fe/main.go#L188-L194

I learned that the "kubernetes" backend for terraform is namespaced. TFO sets up the permissions to allow terraform to access the backend "Secret" in same namespace as the resource, otherwise it defaults to the context's default namespace.

            CustomBackend: fmt.Sprintf(`terraform { 
       backend "kubernetes" { 
         secret_suffix    = "%s" 
         in_cluster_config  = true 
         namespace = "%s"
       } 
     } 
 `, r.FormValue("tfName"), r.FormValue("namespace")), 

https://github.com/isaaguilar/terraform-operator/issues/72#issuecomment-1035209189

zhangtbj commented 2 years ago

Awesome! and thanks for the suggestion, let we fix it later soon! :) +1