hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.33k stars 1.73k forks source link

terraform init with gcs bucket hangs #14937

Closed kmeiGH closed 1 year ago

kmeiGH commented 1 year ago

Hello,

I've been trying to get setup GCP resources with terraform but I've been having trouble getting it setup. I have created a Cloud Storage Bucket in advance:

image

I have also made sure to authenticate myself in my local workstation with gcloud auth application-default login and I gave my account the Storage Admin role so it should have all the permissions for Cloud Storage in this project.

This is my backend.tf in my local directory:

terraform { backend "gcs" { bucket = "pangea-tf-bucket" prefix = "dev/state" } }

When I try to initialize the terraform state with terraform init, it just hangs indefinitely at the last line. No errors... wondering if anyone has seen anything like this previously, or could maybe point me in the right direction. Thanks.

image

edwardmedia commented 1 year ago

@kmeiGH using your backend.tf, it works for me. I wonder if your account has enough permissions. Besides Storage Admin role, what else does it have? Can you try giving it owner on the project?

terraform { 
  backend "gcs" { 
     bucket = "pangea-tf-bucket" 
     prefix = "dev/state" 
  } 
}
kmeiGH commented 1 year ago

@kmeiGH using your backend.tf, it works for me. I wonder if your account has enough permissions. Besides Storage Admin role, what else does it have? Can you try giving it owner on the project?

terraform { 
  backend "gcs" { 
     bucket = "pangea-tf-bucket" 
     prefix = "dev/state" 
  } 
}

Hello @edwardmedia, yeah I am using the owner Service Account. I don't think its a permissions issue. Anyway, I decided to use another backend. I don't know, but would connection issues to google cloud have anything to do with my use of a VPN?

I wouldn't think VPNs are an issue since I can still use the gcloud CLI for other tasks....But if it works for you I guess maybe this issue can be closed?

edwardmedia commented 1 year ago

@kmeiGH does another backend work for you? I am not aware of issues particular to use of a VPN, but which could be an issue. Does your VPN connection stable? Is it limited to a particular region? Have you checked if your service account has the R/W access to the buckets directly?

kmeiGH commented 1 year ago

@kmeiGH does another backend work for you? I am not aware of issues particular to use of a VPN, but which could be an issue. Does your VPN connection stable? Is it limited to a particular region? Have you checked if your service account has the R/W access to the buckets directly?

Yeah, I am using terraform cloud and it works as the backend. I am on the owner SA with cloud storage admin roles so it's not a permission issue. Feel free to close this issue, I suppose it's a network bug?

edwardmedia commented 1 year ago

Cool. closing now. Thanks

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.