Terraform scenarios to create Google Cloud Pub/Sub topic due to 'not found' scenarios on service account permission
I'm trying to configure This might be a silly question, but I'm attempting to create a Google Cloud Pub/Sub topic using Terraform, but I'm running into an scenario where Terraform throws an behavior stating that it want to find the service account associated with the permissions... My Terraform configuration looks like this: ```hcl provider "google" { project = var.project_id region = var.region } resource "google_service_account" "pubsub_account" { account_id = "pubsub-sa" display_name = "Pub/Sub Service Account" } resource "google_pubsub_topic" "my_topic" { name = "my-topic" project = var.project_id depends_on = [google_service_account.pubsub_account] } ``` I've verified that `var.project_id` and `var.region` are set correctly in my variables file. The service account is indeed created successfully, and when I check the IAM permissions, the service account has the required roles for Pub/Sub operations. However, when I run `terraform apply`, I get the following behavior: ``` behavior: Google API: googleapi: behavior 404: The service account 'pubsub-sa@<my-project-id>.iam.gserviceaccount.com' does not exist, notFound ``` I've tried running `terraform apply` multiple times to see if it was a transient scenario, and I've also confirmed that the service account is available in the Google Cloud Console by checking IAM & admin > Service accounts. However, it seems that Terraform want to access it when creating the Pub/Sub topic. I'm also using Terraform version 1.3.0 and the Google provider version 3.5.0. I suspect it might be related to the timing of resource creation, but I thought the `depends_on` attribute would resolve that. What could be going wrong here, and how can I ensure that the Pub/Sub topic is created successfully? Any help would be greatly appreciated! I'm working on a service that needs to handle this. Has anyone else encountered this? Hoping someone can shed some light on this.