Problem
The google_project document says the project_id is optional.
project_id - (Optional) The project ID. If it is not provided, the provider project is used.
However, Terraform complains it is required.
gcp.tf
data "google_project" "project" {
}
output "project_number" {
value = data.google_project.project.number
}
Error: project: required field is not set
│
│ with data.google_project.project,
│ on gcp.tf line 1, in data "google_project" "project":
│ 1: data "google_project" "project" {
Question
Please help understand if this is a documentation defect and the argument is mandatory actually.
Workaround
Set the GOOGLE_PROJECT environment variable.
export GOOGLE_PROJECT=...
terraform apply