-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide explicit project information #3060
Provide explicit project information #3060
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
/gcbrun |
While I welcome this change. this is strange that you got this error, resources should fallback to the provider settings and toolkit configures provider with |
I was not able to reproduce this with this code. I also tried with the latest v6 Terraform plugin for Google Cloud. variable "project_id" {
description = "Toolkit deployment variable: project_id"
type = string
}
variable "region" {
description = "Toolkit deployment variable: region"
type = string
}
variable "zone" {
description = "Toolkit deployment variable: zone"
type = string
}
variable "address" {
description = "The IP address or beginning of the address range allocated for the private service access."
type = string
default = null
}
variable "network_id" {
description = <<-EOT
The ID of the GCE VPC network to configure private service Access.:
`projects/<project_id>/global/networks/<network_name>`"
EOT
type = string
validation {
condition = length(split("/", var.network_id)) == 5
error_message = "The network id must be provided in the following format: projects/<project_id>/global/networks/<network_name>."
}
}
variable "prefix_length" {
description = "The prefix length of the IP range allocated for the private service access."
type = number
default = 16
}
terraform {
required_version = ">= 1.2"
required_providers {
google = {
source = "hashicorp/google"
version = "~> 5.38.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = "~> 5.38.0"
}
}
}
provider "google" {
project = var.project_id
region = var.region
zone = var.zone
}
provider "google-beta" {
project = var.project_id
region = var.region
zone = var.zone
}
resource "random_id" "resource_name_suffix" {
byte_length = 4
}
resource "google_compute_global_address" "private_ip_alloc" {
provider = google-beta
name = "global-psconnect-ip-${random_id.resource_name_suffix.hex}"
purpose = "VPC_PEERING"
address_type = "INTERNAL"
network = var.network_id
prefix_length = var.prefix_length
labels = {}
address = var.address
} and these variables: region = "us-central1"
zone = "us-central1-a"
project_id = "my-project"
network_id = "projects/my-project/global/networks/default"
|
Submission Checklist
Explicitly provide project information, otherwise if environment doesn't set any project information, the plan/apply will fail with following error:
NOTE: Community submissions can take up to 2 weeks to be reviewed.
Please take the following actions before submitting this pull request.