Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

GCP Projects Migration and Terraform Errors

Hello,

This is my very first post here, please be kind. 😉

Recently I have migrated a series of GCP projects from one account to another - due to the GCP restrictions in terms or Org renaming - and now I'm facing an issue with Terraform.

I'm trying to use Terraform on one of the projects that have been migrated but I'm getting an odd error:

...
google_dns_managed_zone.dns-managed-zone-production-[removed]-com: Creating...
╷
│ Error: Error creating ManagedZone: Post "https://dns.googleapis.com/dns/v1/projects/[removed]-production-[removed]/managedZones?alt=json": oauth2: cannot fetch token: 400 Bad Request
│ Response: {
│   "error": "invalid_grant",
│   "error_description": "Account has been deleted"
│ }
│
│   with google_dns_managed_zone.dns-managed-zone-production-[removed]-com,
│   on gcp-dns-zone.tf line 1, in resource "google_dns_managed_zone" "dns-managed-zone-production-[removed]-com":
│    1: resource "google_dns_managed_zone" "dns-managed-zone-production-[removed]-com" {
│

I had the same account name on the initial account and I said I'd better revoke the account and do a re-auth (gcloud auth long [account]).

Even by re-authenticating I'm getting the same error. Strange thing is that I can use gcloud, I do a list of the projects, I can even list the storage buckets. I'd say that the "basics" are find but I still get that error when I want to use TF for infra deployment.

Any help with this would be much appreciated.

Thank you

0 3 2,191
3 REPLIES 3

Managed to sort this out by reinstall gcloud, wiped everything and reinstalled it.

You could have used 'terraform init -upgrade' to inform about the changes, it also clears the authentication cache.

I fixed it using the below command:

gcloud auth application-default login

 

Top Labels in this Space