3
votes

I just started playing with Inferstracture as a code in Google cloud.

  1. Installed Terraform
  2. Installed Terraformer
  3. Created a new GCP project with a virtual machine in it.

My goal is to duplicate the project, with all it's component, into a new project.

In order to do so, I using Terraformer to reverse terraform my existing project. Command:

$ terraformer import google --connect --projects=[project_id] --resources=autoscalers,backendBuckets,backendServices,bigQuery,cloudFunctions,cloudsql,dataProc,disks,dns,firewalls,forwardingRules,gcs,gke,globalAddresses,globalForwardingRules,healthChecks,httpHealthChecks,httpsHealthChecks,iam,images,instanceGroupManagers,instanceGroups,instanceTemplates,instances,interconnectAttachments,kms,memoryStore,monitoring,networkEndpointGroups,networks,nodeGroups,nodeTemplates,project,pubsub,regionAutoscalers,regionBackendServices,regionDisks,regionInstanceGroupManagers,routers,routes,schedulerJobs,securityPolicies,sslPolicies,subnetworks,targetHttpProxies,targetHttpsProxies,targetInstances,targetPools,targetSslProxies,targetTcpProxies,targetVpnGateways,urlMaps,vpnTunnels
2019/06/20 08:00:08 google importing project [project_id]
2019/06/20 08:00:08 google importing... autoscalers
2019/06/20 08:00:19 googleapi: got HTTP response code 404 with body: Not Found

Seems like I have kind of permission problem since google-api reply with Not-Found error code.

I guess Terraformer is accessing is using gcloud permissions to access my gcp environment, is this true?

If it's true, my logged in credientails are owner on this project.

What should I check? How to fix this issue?

1

1 Answers

0
votes

You can use service account with read access to project. And set GOOGLE_CLOUD_KEYFILE_JSON to point to credentials.json of that service account.