Hi,
Having gone through the process of using the 'Google Cloud Setup' in the Google Cloud Console, I downloaded the resulting terraform but am at a loss to where it refers to 'provider_meta' & 'module_name' in 'versions.tf'. The module name being referred to isn't part of the downloaded files and neither can I see it as part of the storage bucket that was set up when downloading the terraform code. So I'd like to know please what this code is doing, is it referring to a bespoke version of the providers and if so where is the module and why would this be necessary over just referring to the providers?
I've changed part of the 'module_name' variable below to remove the seemingly random string value and substituted it for '<stringvar>' as I don't know if it is sensitive information. This '<stringvar>' changes if I redownload the terraform so for some reason it seems something is done behind the scenes that relates to my specific input to the 'Google Cloud Setup' process.
This 'versions.tf' file...
terraform {
required_version = ">= 1.3"
required_providers {
google = {
source = "hashicorp/google"
version = ">= 5.22"
}
google-beta = {
source = "hashicorp/google-beta"
version = ">= 5.22"
}
}
provider_meta "google" {
module_name = "blueprints/terraform/fs-exported-<stringvar>/v0.1.0"
}
provider_meta "google-beta" {
module_name = "blueprints/terraform/fs-exported-<stringvar>/v0.1.0"
}
}
Thanks in advance for any assistance you can offer me as I'm new to GCP & Terraform.
Hi @justin-cloud,
Welcome to Google Cloud Community!
To begin with, Google Cloud Setup helps you to configure Google cloud for scalable workloads. The setups process guides you through an interactive procedure that helps you create a foundational architecture with best practices. The Google Cloud Setup uses an Enterprise foundations blueprint which lets you deploy a foundational set of resources in Google Cloud.
To differentiate between Module and Blueprints, a module is a reusable set of Terraform configuration files that creates a logical abstraction of Terraform resources, while Blueprint is a package of deployable, reusable modules and policy that implements and documents a specific opinionated solution. Deployable configuration for all Terraform blueprints are packaged as Terraform modules.
The versions.tf file content is a description of the providers needed by each specific module and, if needed, the version of Terraform that module is intended to support.
To interpret the terraform command in the version.tf file, here is the breakdown for each command:
terraform {
required_version = ">= 1.3"
required_providers {
google = {
source = "hashicorp/google"
version = ">= 5.22"
}
google-beta = {
source = "hashicorp/google-beta"
version = ">= 5.22"
}
}
}
provider_meta "google" {
module_name ="blueprints/terraform/fs-exported-<stringvar>/v0.1.0"
}
provider_meta "google-beta" {
module_name ="blueprints/terraform/fs-exported-<stringvar>/v0.1.0"
}
}
Since you said that you are new to GCP and Terraform I would like to recommend these documentations to guide you on your journey in GCP.
I hope the above information is helpful.