Google Cloud announced last week the addition of Terraform as a managed service. The service, known as Infrastructure Manager, manages the deployment of Terraform configurations into Google Cloud. In addition to managing the resources needed to process the Terraform configuration, Infrastructure Manager provides an interface for querying the state of the deployment and resources as defined within the configuration.
Infrastructure Manager is not required to leverage Terraform on Google Cloud. Prior to its release, Terraform could, and can still, be used to define and manage deployed resources within Google Cloud. The Terraform Google Cloud Platform Provider can be used to configure and manage Google Cloud infrastructure via Terraform.
When using Infrastructure Manager, a Terraform configuration file is created as with any usage of Terraform. The configuration file can be stored in source control or a Cloud Storage bucket. It is recommended that object versioning be enabled if Cloud Storage is used.
Infrastructure Manager is then used to update the infrastructure deployment based on the configuration file. To accomplish the deployment, a Cloud Build job is created using an image maintained and owned by Google Cloud. The Terraform module created above is downloaded onto this image, initialized, and validated. The configuration is then actioned using either terraform apply or terraform destroy.
Infrastructure Manager stores logs, the configuration file, a list of resources created by the revision, and the generated state file into a generated storage bucket. It is possible to query the Infrastructure Manager for details about the deployment.
To list the deployments in a project, the following command is used:
gcloud alpha infra-manager deployments list --project PROJECT_ID --location "LOCATION"
The revisions in a deployment can be viewed via:
infra-manager revisions list --deployment=projects/PROJECT_ID/locations/LOCATION/deployments/DEPLOYMENT_ID
As noted by Google, Infrastructure Manager does not manage the deployment of applications onto the deployed resources. That will need to be actioned by a separate toolchain using a deployment tool such as Google Cloud Build.
Google notes that Terraform configurations used by Infrastructure Manager should be compatible with Terraform version 1.2.3. This version of Terraform predates the recent licensing change made by Hashicorp to move their open-source products to the BUSL 1.1 license. The current version of Terraform is 1.5.7. It should be noted that Hashicorp shared this release on their own blog and at Google Cloud Next.
Reaction to the release was mostly poor on social media. Many users were confused by the release following so closely after the licensing change announcement by Hashicorp. Hacker News user emptysongglass wondered why Google didn't instead integrate with OpenTofu (formally OpenTF), a fork of Terraform managed by the Linux Foundation.
The general sentiment on social media is that the product does not provide enough features for heavy production usage. Hacker News user candiddevmike doesn't see "a whole lot of benefits over running [Terraform] with Cloud Build and a storage bucket".
However, Reddit user leg100 was more excited about the release, acknowledging that it may be limited now but has major potential. They see a potential for future features such as "leverag[ing] IAM for runs/workspaces; credential-less authentication; [and] automatically map[ping] TFC-like organizations to cloud organizations".
Infrastructure Manager is available for use now within Google Cloud. More details can be found on the release blog post and within the Google Cloud documentation.