Stay organized with collections
Save and categorize content based on your preferences.
Infrastructure as Code (IaC) is the process of provisioning and managing software
application infrastructure using code instead of graphical user interfaces or
command-line scripts.
Provisioning application infrastructure typically involves setting up and
managing virtual machines, database connections, storage, and other
infrastructure elements. Manually managing this infrastructure is time consuming
and error prone, especially when managing applications at scale.
IaC lets you define your infrastructure with configuration files, which allow
you to build, change, and manage your infrastructure in a safe and repeatable
way. You can define resource configurations that you can version, reuse, and
share. IaC lets you specify the desired state of your infrastructure. You can
then deploy the same configuration multiple times to create reproducible
development, test, and production environments.
IaC allows you to treat your infrastructure provisioning and configuration in
the same manner as you handle application code. You can store your provisioning
configuration logic in source control and you can take advantage of continuous
integration and continuous deployment (CI/CD) pipelines.
You can define your infrastructure based on your requirements and
reuse the same configuration to create multiple environments consistently.
You can automate the creation and management of your cloud resources,
including for deployment and test environments.
You can treat infrastructure changes like you treat application changes. For
example, you can ensure that changes to the configuration are reviewed and
automatically validated. Managing production environments through
change-controlled processes using IaC is a best practice.
You can keep a history of all configuration changes. Changes can be audited
and reverted.
You can have a single source of truth for your cloud infrastructure.
IaC tools for Google Cloud
Google Cloud is tightly integrated with many IaC tools. Choose one of the
following tools depending on your use case:
Terraform
In general, to configure and manage Google Cloud infrastructure using
code, use the Terraform provider for Google Cloud.
HashiCorp Terraform is an IaC tool that lets you define
resources in cloud and on-premises in human-readable configuration files
that you can version, reuse, and share. You can then use a consistent
workflow to provision and manage all of your infrastructure throughout its
lifecycle. For more information, see
Overview of Terraform on Google Cloud.
Infrastructure Manager
If you're looking to automate the deployment of your Terraform
configuration, use Infrastructure Manager (Infra Manager).
Infra Manager automates the deployment and management of
Google Cloud infrastructure resources using Terraform.
Infra Manager lets you deploy programmatically to
Google Cloud, allowing you to use this service rather than maintaining
a different toolchain to work with Terraform on Google Cloud. For more
information, see Infra Manager
overview.
Terraform Cloud and Terraform Enterprise
If you require full change management with Terraform across your
organization, use Terraform Cloud or Terraform Enterprise.
Terraform Cloud is a software as a service (SaaS) application that runs Terraform in a stable,
remote environment and securely stores state and secrets. Terraform Cloud
also integrates with the Terraform CLI and connects to common version
control systems (VCS) like GitHub, GitLab, and Bitbucket. When you connect a
Terraform Cloud workspace to a VCS repository, new commits and changes can
automatically trigger Terraform plans. Terraform Cloud also offers an API,
allowing you to integrate it into existing workflows.
Terraform Enterprise lets you set up a self-hosted distribution of Terraform
Cloud. It offers customizable resource limits and is ideal for organizations
with strict security and compliance requirements.
If you want to generate infrastructure with a general-purpose programming
language instead of using Hashicorp Configuration Language (HCL), use Cloud
Development Kit for Terraform (CDKTF).
CDKTF
lets you configure Terraform using a programming language to define and
provision Google Cloud infrastructure and lets you use your existing
toolchain for processes like testing and dependency management.
Pulumi
Pulumi
is another tool you can use to provision infrastructure using programming
languages. You can use Google Cloud provider for Pulumi to author
infrastructure code using programming languages such as TypeScript, Python,
Go, C#, Java or YAML.
Config Controller and Config Connector
To manage Google Cloud resources through Kubernetes, use
Config Controller and Config Connector.
Config Controller and Config Connector let you configure
Google Cloud services and resources using Kubernetes tooling. You can
use GitOps tools like
Config Sync, and
Kubernetes APIs, and you can configure and use platform-engineering
primitives such as admission webhooks and operators.
Another option to manage Google Cloud resources through Kubernetes is
by using Crossplane.
Crossplane connects your Kubernetes cluster to external, non-Kubernetes
resources, and allows platform teams to build custom Kubernetes APIs to
consume those resources. Crossplane acts as a
Kubernetes controller
to watch the state of the external resources and provide state enforcement.
With Crossplane installed in a Kubernetes cluster, users only communicate
with Kubernetes. Crossplane manages the communication to external resources
like Google Cloud. If something modifies or deletes a resource outside
of Kubernetes, Crossplane reverses the change or recreates the deleted
resource.
If you want to automate provisioning, configuration management, application
deployment, orchestration, and other IT processes, use Ansible. For more
information, see Ansible for
Google Cloud.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[[["\u003cp\u003eInfrastructure as Code (IaC) allows for the management of software application infrastructure through code, enabling safer and more repeatable processes than manual methods.\u003c/p\u003e\n"],["\u003cp\u003eUsing IaC involves defining infrastructure with configuration files, allowing for versioning, reuse, and sharing, and enabling the creation of reproducible environments.\u003c/p\u003e\n"],["\u003cp\u003eIaC enables the management of infrastructure changes similarly to application code changes, allowing for review, automated validation, and historical tracking.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Cloud integrates with numerous IaC tools, including Terraform, Infrastructure Manager, Cloud Development Kit for Terraform (CDKTF), Pulumi, and others, each catering to different use cases.\u003c/p\u003e\n"],["\u003cp\u003eTools like Config Controller, Config Connector, Crossplane, and Ansible provide options to use IaC through Kubernetes or for broader automation of IT processes.\u003c/p\u003e\n"]]],[],null,["# Infrastructure as Code on Google Cloud\n\nInfrastructure as Code (IaC) is the process of provisioning and managing software\napplication infrastructure using *code* instead of graphical user interfaces or\ncommand-line scripts.\n\nProvisioning application infrastructure typically involves setting up and\nmanaging virtual machines, database connections, storage, and other\ninfrastructure elements. Manually managing this infrastructure is time consuming\nand error prone, especially when managing applications at scale.\n\nIaC lets you define your infrastructure with configuration files, which allow\nyou to build, change, and manage your infrastructure in a safe and repeatable\nway. You can define resource configurations that you can version, reuse, and\nshare. IaC lets you specify the desired state of your infrastructure. You can\nthen deploy the same configuration multiple times to create reproducible\ndevelopment, test, and production environments.\n\nIaC allows you to treat your infrastructure provisioning and configuration in\nthe same manner as you handle application code. You can store your provisioning\nconfiguration logic in source control and you can take advantage of continuous\nintegration and continuous deployment (CI/CD) pipelines.\n\nBenefits of IaC\n---------------\n\nUsing IaC to set up and manage your application infrastructure is a best\npractice for a number of common use cases. [Google manages its\nsystems with\nIaC](https://www.usenix.org/publications/loginonline/prodspec-and-annealing-intent-based-actuation-google-production),\nand established it as a [standard\npractice](https://sre.google/workbook/configuration-design/) internally.\n\nIaC offers the following benefits:\n\n- You can define your infrastructure based on your requirements and reuse the same configuration to create multiple environments consistently.\n- You can automate the creation and management of your cloud resources, including for deployment and test environments.\n- You can treat infrastructure changes like you treat application changes. For example, you can ensure that changes to the configuration are reviewed and automatically validated. Managing production environments through change-controlled processes using IaC is a best practice.\n- You can keep a history of all configuration changes. Changes can be audited and reverted.\n- You can have a single source of truth for your cloud infrastructure.\n\nIaC tools for Google Cloud\n--------------------------\n\nGoogle Cloud is tightly integrated with many IaC tools. Choose one of the\nfollowing tools depending on your use case:\n\n- **Terraform**\n\n In general, to configure and manage Google Cloud infrastructure using\n code, use the Terraform provider for Google Cloud.\n\n HashiCorp Terraform is an IaC tool that lets you define\n resources in cloud and on-premises in human-readable configuration files\n that you can version, reuse, and share. You can then use a consistent\n workflow to provision and manage all of your infrastructure throughout its\n lifecycle. For more information, see\n [Overview of Terraform on Google Cloud](/docs/terraform/terraform-overview).\n- **Infrastructure Manager**\n\n If you're looking to automate the deployment of your Terraform\n configuration, use Infrastructure Manager (Infra Manager).\n\n Infra Manager automates the deployment and management of\n Google Cloud infrastructure resources using Terraform.\n Infra Manager lets you deploy programmatically to\n Google Cloud, allowing you to use this service rather than maintaining\n a different toolchain to work with Terraform on Google Cloud. For more\n information, see [Infra Manager\n overview](/infrastructure-manager/docs/overview).\n- **Terraform Cloud and Terraform Enterprise**\n\n If you require full change management with Terraform across your\n organization, use Terraform Cloud or Terraform Enterprise.\n\n Terraform Cloud is a software as a service (SaaS) application that runs Terraform in a stable,\n remote environment and securely stores state and secrets. Terraform Cloud\n also integrates with the Terraform CLI and connects to common version\n control systems (VCS) like GitHub, GitLab, and Bitbucket. When you connect a\n Terraform Cloud workspace to a VCS repository, new commits and changes can\n automatically trigger Terraform plans. Terraform Cloud also offers an API,\n allowing you to integrate it into existing workflows.\n\n Terraform Enterprise lets you set up a self-hosted distribution of Terraform\n Cloud. It offers customizable resource limits and is ideal for organizations\n with strict security and compliance requirements.\n\n For more information, see the [Terraform Editions page in the Hashicorp\n documentation](https://developer.hashicorp.com/terraform/intro/terraform-editions).\n- **Cloud Development Kit for Terraform**\n\n If you want to generate infrastructure with a general-purpose programming\n language instead of using Hashicorp Configuration Language (HCL), use Cloud\n Development Kit for Terraform (CDKTF).\n\n [CDKTF](https://developer.hashicorp.com/terraform/cdktf)\n lets you configure Terraform using a programming language to define and\n provision Google Cloud infrastructure and lets you use your existing\n toolchain for processes like testing and dependency management.\n- **Pulumi**\n\n [Pulumi](https://www.pulumi.com/docs/clouds/gcp/)\n is another tool you can use to provision infrastructure using programming\n languages. You can use Google Cloud provider for Pulumi to author\n infrastructure code using programming languages such as TypeScript, Python,\n Go, C#, Java or YAML.\n- **Config Controller and Config Connector**\n\n To manage Google Cloud resources through Kubernetes, use\n Config Controller and Config Connector.\n\n Config Controller and Config Connector let you configure\n Google Cloud services and resources using Kubernetes tooling. You can\n use GitOps tools like\n [Config Sync](/anthos-config-management/docs/config-sync-overview), and\n Kubernetes APIs, and you can configure and use platform-engineering\n primitives such as admission webhooks and operators.\n\n For more information see the\n [Config Controller overview](/anthos-config-management/docs/concepts/config-controller-overview)\n and [Config Connector overview](/config-connector/docs/overview).\n- **Crossplane**\n\n Another option to manage Google Cloud resources through Kubernetes is\n by using Crossplane.\n\n Crossplane connects your Kubernetes cluster to external, non-Kubernetes\n resources, and allows platform teams to build custom Kubernetes APIs to\n consume those resources. Crossplane acts as a\n [Kubernetes controller](https://kubernetes.io/docs/concepts/architecture/controller/)\n to watch the state of the external resources and provide state enforcement.\n With Crossplane installed in a Kubernetes cluster, users only communicate\n with Kubernetes. Crossplane manages the communication to external resources\n like Google Cloud. If something modifies or deletes a resource outside\n of Kubernetes, Crossplane reverses the change or recreates the deleted\n resource.\n\n For more information, see the\n [Crossplane documentation](https://docs.crossplane.io/v1.18/).\n- **Ansible**\n\n If you want to automate provisioning, configuration management, application\n deployment, orchestration, and other IT processes, use Ansible. For more\n information, see [Ansible for\n Google Cloud](https://docs.ansible.com/ansible/latest/collections/google/cloud/).\n\nWhat's next\n-----------\n\n- Learn more about [Terraform](/docs/terraform/terraform-overview)\n- Learn how to [create a basic web server on Compute Engine using Terraform](/docs/terraform/get-started-with-terraform)\n- Learn how to [store Terraform state in a Cloud Storage bucket](/docs/terraform/resource-management/store-state)"]]