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

Error with terraform-provider-flux_v1.0.0-rc.3 plugin applying flux_bootstrap_git.this #487

Closed
mcortinas opened this issue May 31, 2023 · 3 comments

Comments

@mcortinas
Copy link

Hello!

I'm working with tf-controller using FluxCD and last 2 weeks my lab environment has been working very well.

I could install my lab environment 2 weeks ago, but today I tried in the morning in production without luck.
Let me attach the output of my terraform command.
terraform.error.terraform-provider-flux_v1.0.0-rc.3.output.log

My environment is running on top of GKE on GCP, v1.24.11-gke.1000
Constraints....

flux = {
  source = "fluxcd/flux"
  version = "1.0.0-rc.3"
}

I also tried with 1.0.0-rc.2 and 1.0.0-rc.4 with the same error.... :(

Resource versions....

resource "flux_bootstrap_git" "this" {
...
version= "v2.0.0-rc.1"
}

Let me add I have another environment, the lab environment, and I was applied exact the same Terraform code last 2023-05-22T and I could install very well.

@phillebaba
Copy link
Member

@mcortinas could you share how your provider configuration looks.

@mcortinas
Copy link
Author

I found my issue.... let me share it :) I forger to write the provider configuration.... thank you @phillebaba ! in fact @darkowlzz commented me previously in slack . Thank you team!!!!!

$git diff
diff --git a/providers.tf b/providers.tf
index 1390fc5..591cfd4 100644
--- a/providers.tf
+++ b/providers.tf
@@ -28,7 +28,20 @@ provider "helm" {
   }
 }
 
-provider "flux" {}
+provider "flux" {
+  kubernetes = {
+    token                  = data.google_client_config.current.access_token
+    cluster_ca_certificate = base64decode(data.google_container_cluster.gke1.master_auth.0.cluster_ca_certificate)
+    host                   = data.google_container_cluster.gke1.endpoint
+  }
+  git = {
+    url = "ssh://git@${var.gitlab_server}/${data.gitlab_project.this.path_with_namespace}.git"
+    ssh = {
+      username    = "git"
+      private_key = tls_private_key.flux.private_key_pem
+    }
+  }
+}

@mcortinas
Copy link
Author

I found my issue and I fixed it.
Basically, my provider definition was empty and this is wrong.
I shared the code added in order to fix it in my last comment.

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

No branches or pull requests

2 participants