Google Skill boost - Build Infrastructure with Terraform on Google Cloud Challenge lab (GSP345)

Hi all, and greetings! 

 I am facing with an issue on the GSP345 Challenge lab.

In Task 6 it is mentioned to use version 6.0.0 of the network module as follows:

Task 6. Use a module from the Registry

  1. In the Terraform Registry, browse to the Network Module.

  2. Add this module to your main.tf file. Use the following configurations:

  • Use version 6.0.0 (different versions might cause compatibility errors).
  • Name the VPC VPC Name, and use a global routing mode.
  • Specify 2 subnets in the region, and name them subnet-01 and subnet-02. For the subnets arguments, you just need the Name, IP, and Region.
  • Use the IP 10.10.x.0/24 for subnet-01, and 10.10.x.0/24 for subnet-02.
  • You do not need any secondary ranges or routes associated with this VPC, so you can omit them from the configuration.
  1. Once you've written the module configuration, initialize Terraform and run an apply to create the networks.

  2. Next, navigate to the instances.tf file and update the configuration resources to connect tf-instance-1 to subnet-01 and tf-instance-2 to subnet-02.

When I perform 'terraform init' command I get this error:

student_03_xxxxxxxxxxx@cloudshell:~ (qwiklabs-gcp-03-xxxxxxxx)$ terraform init

Initializing the backend...
Initializing modules...
Downloading registry.terraform.io/terraform-google-modules/network/google 6.0.1 for vpc...
- vpc in .terraform/modules/vpc
- vpc.firewall_rules in .terraform/modules/vpc/modules/firewall-rules
- vpc.routes in .terraform/modules/vpc/modules/routes
- vpc.subnets in .terraform/modules/vpc/modules/subnets
- vpc.vpc in .terraform/modules/vpc/modules/vpc

Initializing provider plugins...
- Reusing previous version of hashicorp/google from the dependency lock file
- Finding hashicorp/google-beta versions matching ">= 3.45.0, < 5.0.0"...
- Installing hashicorp/google-beta v4.85.0...
- Installed hashicorp/google-beta v4.85.0 (signed by HashiCorp)

│ Error: Failed to query available provider packages

│ Could not retrieve the list of available versions for provider hashicorp/google: locked provider registry.terraform.io/hashicorp/google 3.55.0 does not match configured version constraint
│ >= 2.15.0, >= 3.33.0, >= 3.45.0, 3.55.0, >= 3.83.0, < 5.0.0; must use terraform init -upgrade to allow selection of new versions

I guess the issue can be related to the provider module version but even if I changed it, the problem is still there.

Any help is welcome

Thanks

Enrico

Solved Solved
1 2 818
1 ACCEPTED SOLUTION

At last I was able to pass the Lab configuring the following version for Google provider:

source = "hashicorp/google"
version = "4.53.0"

And VPC version:

version = "~> 6.0.0"

Thanks
Enrico

View solution in original post

2 REPLIES 2

Facing the same issue. Didn't provide provider version in the first attempt (defaulted to 6.14.1) and now fixed the google provider version at 6.11.1; Both attempts resulted in failure

required_providers {
google = {
source = "hashicorp/google"
version = "6.11.1"
}
}

At last I was able to pass the Lab configuring the following version for Google provider:

source = "hashicorp/google"
version = "4.53.0"

And VPC version:

version = "~> 6.0.0"

Thanks
Enrico

Top Labels in this Space