Open Vikas252 opened 1 month ago
Hi @Vikas25!
This looks more like troubleshooting than a bug. I noticed that you are using a different nomenclature for the network
argument. You need to use the google_compute_network.vpc.name
for the google_container_cluster.network
instead of data.google_compute_network.vpc.self_link
As you can see in the API documentation The correct nomenclature for the network argument is projects/my-project/global/networks/my-network
, so you could test the functionality with the next structure which is similar to the terraform registry example:
resource "google_container_cluster" "container_cluster_18708" {
name = "container-cluster-18708"
location = "us-central1"
deletion_protection = false
initial_node_count = 1
network = "projects/my-project/global/networks/my-network"
}
It is a good practice to use locals, variables, modules and so on, but I suggest you to 1st read the API documentation to see how it works and simplify your code for testing purposes, then you can go and adapt this to your current code configuration.
Community Note
Terraform Version & Provider Version(s)
Terraform v1.9.1 on windows_386
Affected Resource(s)
google_container_cluster
Terraform Configuration
main.tf
network.tf
outputs.tf
Debug Output
https://gist.github.com/Vikas252/20a5f4a529d22dfbed5f0963d98e232f
Expected Behavior
Should create resources without any errors
Actual Behavior
All networking resources are created which are suppose to be created but getting error when tf is provisioning GKE
Error: googleapi: Error 400: Malformed value for network field: "projects/{PROJECT_ID}/global/networks/https://www.googleapis.com/compute/v1/projects/{PROJECT_ID}/global/networks/staging-private-network"
Steps to reproduce
terraform apply
Important Factoids
No response
References
All the codes which ive used are from
https://github.com/terraform-google-modules
ive used Kubernetes engine example for to create a autopilot cluster and am using a shared VPC