This page describes how to upload a Terraform configuration to a Cloud Storage
bucket.

A storage bucket allows you to control access to the configuration. If you are
working with a configuration that doesn't need access controls, you can use a
public Git repo.

For details about Terraform configurations and Infra Manager, see
[Terraform and Infrastructure Manager](https://docs.cloud.google.com/infrastructure-manager/docs/infra-manager-terraform.md.txt).

## Before you begin

1. Ensure [Infra Manager is enabled](https://docs.cloud.google.com/infrastructure-manager/docs/enable-service.md.txt).
2. Identify the Terraform configuration to upload to a storage bucket.

## Create a storage bucket

Create or identify an existing Cloud Storage bucket to store the
Terraform configuration. You can use any storage bucket, but it's common to use
a bucket in the same project where you will run Infra Manager.

The storage bucket can be in any project and location. It's common to
create this bucket in the same project and location as where you run the
Infra Manager service.

To create the storage bucket, see
[Create buckets](https://docs.cloud.google.com/storage/docs/creating-buckets.md.txt).

## Grant read permission for the bucket

If the storage bucket is in a different project from the project where you
are running Infra Manager, then you need to ensure that
Infra Manager's service account has read permission for the bucket.
See
[Configure the service account](https://docs.cloud.google.com/infrastructure-manager/docs/configure-service-account.md.txt)
for more details.

If the storage bucket is in the same project as Infra Manager, read
permission to the bucket is already enabled.

## Enable Object Versioning for the bucket

We recommend versioning the Terraform configuration so that you can track
changes and manage your infrastructure as code.

To version the configuration when it's stored in a Cloud Storage bucket, see
[Use Object Versioning](https://docs.cloud.google.com/storage/docs/using-object-versioning.md.txt).

For more details, see [Object Versioning](https://docs.cloud.google.com/storage/docs/object-versioning.md.txt).

## Upload the Terraform configuration

Upload the Terraform configuration to the storage bucket. To choose an upload
method, see [Object uploads](https://docs.cloud.google.com/storage/docs/uploads.md.txt).

## What's next

- Deploy the Terraform configuration by [Creating a deployment](https://docs.cloud.google.com/infrastructure-manager/docs/deploy-resources.md.txt).
- Learn more about [Terraform and Google Cloud](https://docs.cloud.google.com/docs/terraform.md.txt).