Hi@akhtar,
You need to create a service account first. Then only you can create a service account key. You can take help from the below-given example.
provider "google" {
project = "terraform-pro-289314"
region = "asia-southeast1"
}
resource "google_service_account" "myaccount" {
account_id = "myaccount"
display_name = "My Service Account"
}
resource "google_service_account_key" "mykey" {
service_account_id = google_service_account.myaccount.name
public_key_type = "TYPE_X509_PEM_FILE"
}
Hope this helps!!
If you need to know more about Google Cloud, It's recommended to go for Google Cloud architect certification course.
Thanks!