mmv1/products/compute/RegionDiskResourcePolicyAttachment.yaml (69 lines of code) (raw):
# Copyright 2024 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
name: 'RegionDiskResourcePolicyAttachment'
api_resource_type_kind: Disk
description: |
Adds existing resource policies to a disk. You can only add one policy
which will be applied to this disk for scheduling snapshot creation.
~> **Note:** This resource does not support zonal disks (`google_compute_disk`). For zonal disks, please refer to [`google_compute_disk_resource_policy_attachment`](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_disk_resource_policy_attachment)
docs:
id_format: '{{project}}/{{region}}/{{disk}}/{{name}}'
base_url: 'projects/{{project}}/regions/{{region}}/disks/{{disk}}'
self_link: 'projects/{{project}}/regions/{{region}}/disks/{{disk}}'
create_url: 'projects/{{project}}/regions/{{region}}/disks/{{disk}}/addResourcePolicies'
delete_url: 'projects/{{project}}/regions/{{region}}/disks/{{disk}}/removeResourcePolicies'
delete_verb: 'POST'
immutable: true
timeouts:
insert_minutes: 20
update_minutes: 20
delete_minutes: 20
async:
actions: ['create', 'delete', 'update']
type: 'OpAsync'
operation:
base_url: '{{op_id}}'
result:
resource_inside_response: false
identity:
- name
nested_query:
keys:
- resourcePolicies
is_list_of_ids: true
modify_by_patch: false
custom_code:
encoder: 'templates/terraform/encoders/compute_region_disk_resource_policies_attachment.go.tmpl'
decoder: 'templates/terraform/decoders/compute_disk_resource_policies_attachment.go.tmpl'
pre_delete: 'templates/terraform/pre_delete/compute_region_disk_resource_policies_attachment.go.tmpl'
examples:
- name: 'region_disk_resource_policy_attachment_basic'
primary_resource_id: 'attachment'
vars:
base_disk_name: 'my-base-disk'
snapshot_name: 'my-snapshot'
disk_name: 'my-disk'
policy_name: 'my-resource-policy'
parameters:
- name: 'disk'
type: ResourceRef
description: |
The name of the regional disk in which the resource policies are attached to.
url_param_only: true
required: true
resource: 'Disk'
imports: 'name'
- name: 'region'
type: ResourceRef
description: 'A reference to the region where the disk resides.'
url_param_only: true
required: false
default_from_api: true
resource: 'Region'
imports: 'name'
properties:
- name: 'name'
type: String
description: |
The resource policy to be attached to the disk for scheduling snapshot
creation. Do not specify the self link.
required: true