Google Cloud Deployment Manager Deployment
This page shows how to write Terraform for Cloud Deployment Manager Deployment and write them securely.
google_deployment_manager_deployment (Terraform)
The Deployment in Cloud Deployment Manager can be configured in Terraform with the resource name google_deployment_manager_deployment. The following sections describe 2 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "google_deployment_manager_deployment" "this" {
create_policy = var.create_policy
delete_policy = var.delete_policy
description = var.description
name = var.name
preview = var.preview
resource "google_deployment_manager_deployment" "deployment" {
count = length(var.deployment)
name = lookup(var.deployment[count.index], "name")
description = lookup(var.deployment[count.index], "description", null)
create_policy = lookup(var.deployment[count.index], "create_policy", null)
delete_policy = lookup(var.deployment[count.index], "delete_policy", null)
Parameters
-
create_policyoptional - string
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: "CREATE_OR_ACQUIRE" Possible values: ["ACQUIRE", "CREATE_OR_ACQUIRE"]
-
delete_policyoptional - string
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: "DELETE" Possible values: ["ABANDON", "DELETE"]
-
deployment_idoptional computed - string
Unique identifier for deployment. Output only.
-
descriptionoptional - string
Optional user-provided description of deployment.
Output only. URL of the manifest representing the last manifest that was successfully deployed.
-
namerequired - string
Unique name for the deployment
-
previewoptional - bool
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.
Output only. Server defined URL for the resource.
-
labelsset block-
keyoptional - string
Key for label.
-
valueoptional - string
Value of label.
-
-
targetlist block -
timeoutssingle block
Explanation in Terraform Registry
A collection of resources that are deployed and managed together using a configuration file
Warning: Deployment Manager shares similar behavior with Terraform as both products manage GCP resource lifecycle and state. This Terraform resource is intended only to manage a Deployment resource, and attempts to manage the Deployment's resources in Terraform as well will likely result in errors or unexpected behavior as the two tools fight over ownership. We strongly discourage doing so unless you are an experienced user of both tools. 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=truetopreview=false).
Frequently asked questions
What is Google Cloud Deployment Manager Deployment?
Google Cloud Deployment Manager Deployment is a resource for Cloud Deployment Manager of Google Cloud Platform. Settings can be wrote in Terraform.
Where can I find the example code for the Google Cloud Deployment Manager Deployment?
For Terraform, the niveklabs/google and mikamakusa/terraform source code examples are useful. See the Terraform Example section for further details.