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

🐛 : Terraform Plan is not working for GCP provider #753

Open
ajaydevtron opened this issue Jan 30, 2025 · 0 comments
Open

🐛 : Terraform Plan is not working for GCP provider #753

ajaydevtron opened this issue Jan 30, 2025 · 0 comments
Labels
🐛 bug Something isn't working

Comments

@ajaydevtron
Copy link

Describe the bug

I installed Gaia using Helm with the following command:

helm install gaia https://github.com/gaia-app/chart/archive/refs/tags/v0.1.2.tar.gz --namespace gaia

After adding AWS credentials through the Gaia UI, we were able to create AWS resources successfully.

However, when trying to create GCP resources, I uploaded the JSON file of a GCP service account and created the stack. But when running the plan command, it seems that the JSON file is not being passed completely

Plan logs

gaia] running terraform job
?
? Error: error unmarshaling credentials: unexpected end of JSON input
? 
?   with provider["registry.terraform.io/hashicorp/google"],
?   on main.tf line 2, in provider "google":
?    2: provider "google" {
? 
?

Planning failed. Terraform encountered an error while generating this plan.

[gaia] analysing plan
{"timestamp":"2025-01-30T12:23:38.865+00:00","status":400,"error":"Bad Request","path":"/api/runner/stacks/154bbef3-ca1b-4762-86fd-e5

Pod manifest for job

apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: 2025-01-30T12:23:25Z
  name: gaia-job-eb5e79da-a261-4d8a-a270-243f5e225e2f
  namespace: utils
  resourceVersion: "46907480"
  uid: 125803a8-84d4-48fa-8eed-b9eced5263d2
spec:
  containers:
    - command:
        - /bin/sh
      env:
        - name: TF_IN_AUTOMATION
          value: "true"
        **- name: GOOGLE_CREDENTIALS**
          value: |-
            {
              "type": "service_account",
              "project_id": "xyz",
              "private_key_id": "ee8bd92e2c7e126b994ce0c0b056d9fa6",
              "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC1ag+qO9ZVbmOp\n18lkp7E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Bm3jPj+Z6GQ3fyeQOytbk+M1beuWz9Q/KtZwihacmkJbdZrM3Fd\nSODgf0s5KCtAh2OEcInqN2Wy2phNfxAyzQPtL2qHCQvTQ64focpJAr5zpE+4T2kk\nl8bjcFV25tn0nHqjd3HyYEhM+Sv6CfMfX4m6GD0HJjEcqHgU/9mPpN+hAoGAFtGu\nxHSJQFxTIP0oq0nyrgpmKEeBXxlCkaTzBfBpP5LB76I2PKyrmoDleiDzq3sIWpyI\nTUEfz5RymM17gyswBLz+/o7lEgjDxTniVF/EOaBoiJ3g3cUa7
        - name: GOOGLE_PROJECT
          value: xyz
      image: hashicorp/terraform:latest
      imagePullPolicy: Always
      name: terraform
      resources: {}
      stdin: true
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: File
      volumeMounts:
        - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
          name: kube-api-access-p94x5
          readOnly: true
  dnsPolicy: ClusterFirst
  enableServiceLinks: true
  nodeName: xyz
  preemptionPolicy: PreemptLowerPriority
  priority: 0
  restartPolicy: Never
  schedulerName: default-scheduler
  securityContext: {}
  serviceAccount: default
  serviceAccountName: default
  terminationGracePeriodSeconds: 30
  tolerations:
    - effect: NoExecute
      key: node.kubernetes.io/not-ready
      operator: Exists
      tolerationSeconds: 300
    - effect: NoExecute
      key: node.kubernetes.io/unreachable
      operator: Exists
      tolerationSeconds: 300

To Reproduce
Steps to reproduce the behavior:

  1. Add the GCP service account on gaia UI in credentials page
  2. Add an module where i have the Terraform codes
  3. Create a stack and try to run plan
  4. See error

Expected behavior
Plan should work in the case of GCP based stack

Screenshots

Image

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [chrome]

Additional context
Add any other context about the problem here.

@ajaydevtron ajaydevtron added the 🐛 bug Something isn't working label Jan 30, 2025
@ajaydevtron ajaydevtron changed the title 🐛 : bug title Terraform Plan is not working for GCP provider Terraform Plan is not working for GCP provider Jan 30, 2025
@ajaydevtron ajaydevtron changed the title Terraform Plan is not working for GCP provider 🐛 : Terraform Plan is not working for GCP provider Jan 30, 2025
@gaia-app gaia-app deleted a comment Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant