» google_deployment_manager_deployment

A collection of resources that are deployed and managed together using a configuration file

In addition, due to limitations of the API, Terraform will treat deployments in preview as recreate-only for any update operation other than actually deploying an in-preview deployment (i.e. preview=true to preview=false).

» Example Usage - Deployment Manager Deployment Basic

resource "google_deployment_manager_deployment" "deployment" {
  name = "my-deployment"

  target {
    config {
      content = file("path/to/config.yml")
    }
  }

  labels {
    key = "foo"
    value = "bar"
  }
}

» Example Usage - Deployment Manager Deployment Imports

resource "google_deployment_manager_deployment" "deployment" {
  name = "my-deployment"
  target {
    config {
      content = <<EOF
imports:
- path: service_account.jinja
- path: vm.jinja

resources:
- name: &SA_NAME my-vm-account
  type: service_account.jinja
- name: my-vm
  type: vm.jinja
  properties:
    serviceAccountId: *SA_NAME
EOF

    imports {
      name = "vm.jinja"
      content = file("path/to/vm.jinja")
    }

    imports {
      name = "service_account.jinja"
      content = file("path/to/service_account.jinja")
    }
  }
}

» Argument Reference

The following arguments are supported:

  • name - (Required) Unique name for the deployment

  • target - (Required) Parameters that define your deployment, including the deployment configuration and relevant templates. Structure is documented below.

The target block supports:

  • config - (Required) The root configuration file to use for this deployment. Structure is documented below.

  • imports - (Optional) Specifies import files for this configuration. This can be used to import templates or other files. For example, you might import a text file in order to use the file in a template. Structure is documented below.

The config block supports:

  • content - (Required) The full YAML contents of your configuration file.

The imports block supports:

  • content - (Optional) The full contents of the template that you want to import.

  • name - (Optional) The name of the template to import, as declared in the YAML configuration.


  • description - (Optional) Optional user-provided description of deployment.

  • labels - (Optional) Key-value pairs to apply to this labels. Structure is documented below.

  • create_policy - (Optional) Set the policy to use for creating new resources. Only used on create and update. Valid values are CREATE_OR_ACQUIRE (default) or ACQUIRE. If set to ACQUIRE and resources do not already exist, the deployment will fail. Note that updating this field does not actually affect the deployment, just how it is updated. Default value is CREATE_OR_ACQUIRE. Possible values are ACQUIRE and CREATE_OR_ACQUIRE.

  • delete_policy - (Optional) Set the policy to use for deleting new resources on update/delete. Valid values are DELETE (default) or ABANDON. If DELETE, resource is deleted after removal from Deployment Manager. If ABANDON, the resource is only removed from Deployment Manager and is not actually deleted. Note that updating this field does not actually change the deployment, just how it is updated. Default value is DELETE. Possible values are ABANDON and DELETE.

  • preview - (Optional) If set to true, a deployment is created with "shell" resources that are not actually instantiated. This allows you to preview a deployment. It can be updated to false to actually deploy with real resources. ~>NOTE: Deployment Manager does not allow update of a deployment in preview (unless updating to preview=false). Thus, Terraform will force-recreate deployments if either preview is updated to true or if other fields are updated while preview is true.

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

The labels block supports:

  • key - (Optional) Key for label.

  • value - (Optional) Value of label.

» Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format projects/{{project}}/deployments/{{name}}

  • deployment_id - Unique identifier for deployment. Output only.

  • manifest - Output only. URL of the manifest representing the last manifest that was successfully deployed.

  • self_link - Output only. Server defined URL for the resource.

» Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 60 minutes.
  • update - Default is 60 minutes.
  • delete - Default is 60 minutes.

» Import

Deployment can be imported using any of these accepted formats:

$ terraform import google_deployment_manager_deployment.default projects/{{project}}/deployments/{{name}}
$ terraform import google_deployment_manager_deployment.default {{project}}/{{name}}
$ terraform import google_deployment_manager_deployment.default {{name}}

» User Project Overrides

This resource supports User Project Overrides.