Infrastructure Manager automates the deployment and management of Google Cloud
infrastructure resources by using Terraform configurations. As a managed
Infrastructure as Code (IaC) service, Infra Manager helps you define,
deploy, and maintain cloud infrastructure consistently across environments.

You can deploy Terraform configurations (also called *blueprints*) from
Cloud Storage buckets, Git repositories, or local directories. With
Infra Manager, you can also manage your infrastructure lifecycle
through deployments and revisions, preview planned changes before applying them,
and automate workflows with Cloud Build.

Infra Manager isn't an application deployment tool, and it doesn't
manage the deployment of applications onto your resources. Application
deployment in Infra Manager is limited to the resources that the
Terraform provider for Google Cloud supports, such as Cloud Run
services or Cloud Run functions. For application lifecycle management
and continuous delivery, consider using Google Cloud products such as
[App Lifecycle Manager](https://docs.cloud.google.com/app-lifecycle-manager/overview.md.txt),
[Cloud Build](https://docs.cloud.google.com/build/docs.md.txt), and [Cloud Deploy](https://docs.cloud.google.com/deploy/docs.md.txt), or
third-party tools.

Familiarity with Terraform helps you customize your deployments. However, the
Google Cloud console lets you deploy and experiment with existing Terraform
configurations without writing Terraform code. To learn more about Terraform
with Google Cloud, see [Terraform on Google Cloud](https://docs.cloud.google.com/docs/terraform.md.txt).

To learn more about what Terraform is and how it works, see HashiCorp's
[What is Terraform?](https://developer.hashicorp.com/terraform/intro).

## Infra Manager and Infrastructure as Code

Infra Manager lets you use IaC to manage the lifecycle of
Google Cloud resources:

- Terraform is defined declaratively in a [Terraform configuration](https://docs.cloud.google.com/infrastructure-manager/docs/infra-manager-terraform.md.txt). This means that the configuration describes the end state of your infrastructure.
- You can version the Terraform configuration either in a Git repository, or in a [Cloud Storage bucket](https://docs.cloud.google.com/infrastructure-manager/docs/upload-terraform-configuration.md.txt). Use [Object Versioning](https://docs.cloud.google.com/storage/docs/object-versioning.md.txt) to version configurations in a storage bucket.
- Use Infra Manager to update your infrastructure deployment with [revisions](https://docs.cloud.google.com/infrastructure-manager/docs/deployments-revisions.md.txt#revisions). For each revision, Infra Manager stores the following:
  - Logs
  - The configuration used to do the revision
  - The list of Google Cloud resources created by the revision
  - The state file created as part of each deployment and revision

See [Infrastructure as Code on Google Cloud](https://docs.cloud.google.com/docs/terraform/iac-overview.md.txt)
for more information about IaC.

## Customize deployments using input values

You can parameterize your Terraform configurations with Terraform input
variables, which Infra Manager refers to as *input values*. Input
values let you customize a deployment while reusing the same configuration across
multiple environments or deployments without modifying the Terraform
configuration source code. You can provide values for required variables that
don't have a default value, or override existing default values.

You can pass input values when you [create](https://docs.cloud.google.com/infrastructure-manager/docs/deploy-resources.md.txt),
[update](https://docs.cloud.google.com/infrastructure-manager/docs/update-deployment.md.txt), or
[preview](https://docs.cloud.google.com/infrastructure-manager/docs/preview-deployment.md.txt) a deployment:

- **Google Cloud console** : Enter keys and values on the **Terraform details** page when you create or update a deployment.
- **Google Cloud CLI** : Use the `--input-values` flag when you create, update, or preview a deployment.

For more information about how to define and use input variables in Terraform,
see HashiCorp's [input variables documentation](https://developer.hashicorp.com/terraform/language/values/variables).

## How Infra Manager works

The following is a description of what happens when you deploy infrastructure
with Infra Manager by using the Google Cloud console or the
Google Cloud CLI:

1. The infrastructure resources to deploy onto Google Cloud are defined in a Terraform configuration.
   - You can create this file yourself, or use a configuration that is already written for Google Cloud. See [Terraform and Infrastructure Manager](https://docs.cloud.google.com/infrastructure-manager/docs/infra-manager-terraform.md.txt) for details.
   - You can store the Terraform configuration in a Cloud Storage bucket or a Git repository. If you use the Google Cloud CLI, you can also deploy a configuration from your local machine.
2. When you use Infra Manager to deploy resources from a Terraform configuration, you create a deployment. To create a deployment, Infra Manager:
   1. Validates the request. For example, it ensures that you specified the location of the Terraform configuration in your request.
   2. Creates a Cloud Build job using a container image. This image is owned and maintained by Google Cloud. See [Runtime environment](https://docs.cloud.google.com/infrastructure-manager/docs/overview.md.txt#runtime_environment) for details about the Cloud Build environment. The Cloud Build job automates the following tasks:
      1. Downloads the Terraform module from the storage bucket or Git repository.
      2. Initializes Terraform (`terraform init`)
      3. Validates the Terraform configuration (`terraform validate`)
      4. Actuates the configuration (`terraform apply`, or `terraform destroy` if you are deleting a deployment)
      5. Streams Cloud Build logs into a storage bucket created by Infra Manager.
      6. If the deployment fails, Infra Manager automatically retries the `terraform init` or `terraform apply` operations in certain scenarios, such as if it failed with intermittent network outages. These retries are performed a limited number of times.
   3. Creates a Cloud Storage bucket and stores metadata about the deployment. For more information about the deployment and metadata, see [Deployment and revision overview](https://docs.cloud.google.com/infrastructure-manager/docs/deployments-revisions.md.txt).
3. When the deployment is complete, the Google Cloud resources are
   provisioned as the configuration described them.

   You can query Infra Manager deployment for:
   - The status of the deployment.
   - The list of resources that are deployed as part of the deployment.
   - Details about individual resources that are part of a deployment.

## Runtime environment

The runtime environment of Infra Manager is an
[ephemeral Cloud Build environment](https://docs.cloud.google.com/build/docs/overview.md.txt#ephemeral-build-environment).
Infra Manager executes Terraform commands in this
Cloud Build environment, and then the environment is discarded.

The specific operating system, available software, and other configuration
details of the Cloud Build environment are internal implementation
details of Infra Manager, and can change at any time.

You can specify which [supported version of Terraform](https://docs.cloud.google.com/infrastructure-manager/docs/infra-manager-terraform.md.txt#terraform_versions)
to use for each deployment.

## Don't include personal or sensitive information

Don't include personal or sensitive information in Terraform configuration
values.

For additional information about Terraform configurations and sensitive data,
see
[Terraform configuration values and sensitive data](https://docs.cloud.google.com/infrastructure-manager/docs/infra-manager-terraform.md.txt#config-values-data).

## What's next

- Learn more about [Terraform with Google Cloud](https://docs.cloud.google.com/docs/terraform.md.txt).
- [Create a deployment](https://docs.cloud.google.com/infrastructure-manager/docs/deploy-resources.md.txt).
- [Update a deployment](https://docs.cloud.google.com/infrastructure-manager/docs/update-deployment.md.txt).
- [Automate deployments](https://docs.cloud.google.com/infrastructure-manager/docs/automate-git.md.txt).
- [Delete a deployment](https://docs.cloud.google.com/infrastructure-manager/docs/delete-deployments.md.txt).