'(Terraform, GCP) Error creating Network: googleapi: Error 403: Permission denied on resource project myProject. Details:[], forbidden

I'm trying to make a VPC on GCP with the Terraform code below:

provider "google" {
  credentials = file("myCredentials.json")
  project     = "myProject"
  region      = "asia-northeast1"
}

resource "google_compute_network" "vpc" {
  name = "main"
  auto_create_subnetworks = false
}

And this is my project name, number and ID:

enter image description here

But I got this error below:

Error: Error creating Network: googleapi: Error 403: Permission denied on resource project myProject.
Details:
[
  {
    "@type": "type.googleapis.com/google.rpc.Help",
    "links": [
      {
        "description": "Google developer console API key",
        "url": "https://console.developers.google.com/project/myProject/apiui/credential"
      }
    ]
  },
  {
    "@type": "type.googleapis.com/google.rpc.ErrorInfo",
    "domain": "googleapis.com",
    "metadata": {
      "consumer": "projects/myProject",
      "service": "compute.googleapis.com"
    },
    "reason": "CONSUMER_INVALID"
  }
]
, forbidden

  with google_compute_network.vpc,
  on 1st.tf line 25, in resource "google_compute_network" "vpc":
  25: resource "google_compute_network" "vpc" {

Are there any mistakes with my Terraform code?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source