Created a service user to manage terraform under the project and gave it roles/owner. Created the key for this terraform user.
Terraform code is simple:
resource "google_pubsub_topic" "my_topic" {
name = "my_topic"
project = "${var.project_id}"
}
just creating a pub-sub topic.
terraform plan works but terraform apply gives me:
google_pubsub_topic.my_topic: googleapi: Error 403: User not authorized to perform this action., forbidden
I have even tried giving the service account roles/pubsub.admin not sure I understand what's going on because my service account has the owner role associated with it yet it can't create a pubsub topic.
Can anybody help me figure this out please?
Any help would be highly appreciated.
Thanks in Advance
gcloud iam service-accounts create terraform \ --display-name "Terraform admin account" gcloud projects add-iam-policy-binding myproject-182220 \ --member serviceAccount:terr...@myproject-182220.iam.gserviceaccount.com \ --role roles/owner gcloud iam service-accounts keys create terraform-admin.json \ --iam-account terr...@myproject-182220.iam.gserviceaccount.com
I had created the service account using gcloud.
gcloud iam service-accounts create terraform \ --display-name "Terraform admin account" gcloud projects add-iam-policy-binding myproject-182220 \ --member serviceAccou...@myproject-182220.iam.gserviceaccount.com \ --role roles/owner gcloud iam service-accounts keys create terraform-admin.json \ --iam-account terr...@myproject-182220.iam.gserviceaccount.com