blob: b6cb3d92fa5bb8dfeac161b6f0e1c4ccbf3440d2 [file] [log] [blame]
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in
# .github/CONTRIBUTING.md.
#
# ----------------------------------------------------------------------------
subcategory: "Cloud Deployment Manager"
description: |-
A collection of resources that are deployed and managed together using
a configuration file
---
# google\_deployment\_manager\_deployment
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=true` to
`preview=false`).
## Example Usage - Deployment Manager Deployment Basic
```hcl
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
```hcl
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](#nested_target).
<a name="nested_target"></a>The `target` block supports:
* `config` -
(Required)
The root configuration file to use for this deployment.
Structure is [documented below](#nested_config).
* `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](#nested_imports).
<a name="nested_config"></a>The `config` block supports:
* `content` -
(Required)
The full YAML contents of your configuration file.
<a name="nested_imports"></a>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](#nested_labels).
* `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`, `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`, `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.
<a name="nested_labels"></a>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](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-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:
* `projects/{{project}}/deployments/{{name}}`
* `{{project}}/{{name}}`
* `{{name}}`
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Deployment using one of the formats above. For example:
```tf
import {
id = "projects/{{project}}/deployments/{{name}}"
to = google_deployment_manager_deployment.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), Deployment can be imported using one of the formats above. For example:
```
$ 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](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).