Follow this link.
- Create a GCP project here if you don't have one already
- Enable the following APIs:
- Create a service account here with the
Editor
role. - Download your service account key:
-
- Go the
Service Account
tab in IAM
- Go the
-
- Click on your service account
-
- Go to the
Keys
tab.
- Go to the
-
- Select
ADD KEY
>Create new key
- Select
-
- Use JSON key type
-
- Save the key on disk
Create a file called terraform.tfvars
and add the following content:
project_id = "<PROJECT_ID>"
credentials_file = "<PATH/TO/FILE>.json"
Where <PROJECT_ID>
is the ID of your GCP project and <PATH/TO/FILE>.json
is the path to the service account key you downloaded in the previous step.
This file will be used to populate the variables in the variables.tf
file.
Terraform will automatically load the variables from this file.