Infrastructure Manager (Infra Manager) is a managed service that simplifies
and automates the deployment and management of your Google Cloud infrastructure
resources. By using Terraform configurations (also called blueprints), Infra Manager
provides a managed Google Cloud toolchain to implement Infrastructure as Code (IaC)
workflows.

With Infra Manager, you can:

- Define your infrastructure declaratively using Terraform.
- Deploy Terraform configurations stored in Cloud Storage buckets, Git repositories, or your local directories.
- Manage your infrastructure lifecycle through deployments and revisions.
- Create preview deployments to see how changes affect your infrastructure before applying them.
- Use integrations with Cloud Build for automated workflows.

Infra Manager doesn't manage the deployment of applications onto
your resources. For application deployment, consider using Google Cloud
products like [App Lifecycle Manager](https://docs.cloud.google.com/saas-runtime/docs), [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.

To work with Infra Manager, you should be familiar with Terraform.
To learn more about Terraform with Google Cloud, see [Terraform on
Google Cloud](https://docs.cloud.google.com/docs/terraform).

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. 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 in a scenario when you use
Infra Manager to deploy infrastructure:

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, a Git repository, or on 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 in your command you specified the location of the Terraform configuration.
   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).