Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions mmv1/products/compute/ZoneVmExtensionPolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Copyright 2026 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: 'ZoneVmExtensionPolicy'
description: 'A Zone VM Extension Policy.'
base_url: 'projects/{{project}}/zones/{{zone}}/vmExtensionPolicies'
self_link: 'projects/{{project}}/zones/{{zone}}/vmExtensionPolicies/{{name}}'
update_verb: 'PATCH'
update_mask: true
custom_code:
pre_update: 'templates/terraform/pre_update/vm_extension_policy_name.go.tmpl'

samples:
- name: 'compute_zone_vm_extension_policy_basic'
primary_resource_id: 'ops_agent_policy'
steps:
- name: 'compute_zone_vm_extension_policy_basic'
vars:
policy_name: 'zonal-ops-agent-policy'
- name: 'compute_zone_vm_extension_policy_update'
vars:
policy_name: 'zonal-ops-agent-policy'


autogen_async: true
async:
actions: ['create', 'delete', 'update']
type: 'OpAsync'
operation:
base_url: 'projects/{{project}}/zones/{{zone}}/operations/{{op_id}}'

parameters:
- name: 'zone'
type: String
required: true
immutable: true
url_param_only: true
description: 'Name of the zone for this request.'

properties:
- name: 'name'
type: String
required: true
immutable: true
description: |-
Name of the resource. Provided by the client when the resource is created.
- name: 'description'
type: String
description: 'An optional description of this resource.'
- name: 'extensionPolicies'
type: Map
required: true
description: |-
A map of extension names (for example, "ops-agent") to their corresponding policy configurations.
value_type:
type: NestedObject
properties:
- name: 'pinnedVersion'
type: String
description: 'The specific version of the extension to install.'
- name: 'stringConfig'
type: String
description: 'String-based configuration data for the extension.'
key_name: 'extension_name'
- name: 'instanceSelectors'
type: Array
description: 'Selectors to target VMs for this policy.'
item_type:
type: NestedObject
properties:
- name: 'labelSelector'
type: NestedObject
description: 'LabelSelector matches VM labels.'
properties:
- name: 'inclusionLabels'
type: KeyValuePairs
description: 'A map of key-value pairs representing VM labels.'
- name: 'priority'
type: Integer
default_from_api: true
description: 'Priority of this policy.'
- name: 'creationTimestamp'
type: String
description: 'Creation timestamp in RFC3339 text format.'
output: true
- name: 'id'
type: String
description: 'The unique identifier for the resource.'
output: true
- name: 'kind'
type: String
description: 'Type of the resource.'
output: true
- name: 'managedByGlobal'
type: Boolean
description: 'Indicates if this policy is managed by a global policy.'
output: true
- name: 'state'
type: String
description: 'Current state of the policy.'
output: true
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
obj["name"] = d.Get("name").(string)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you certain you need this? I'm surprised it is required, it seems like it might have been left over from a prior iteration.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
resource "google_compute_zone_vm_extension_policy" "{{$.PrimaryResourceId}}" {
name = "zonal-ops-agent-vme-policy-%{random_suffix}"
zone = "us-central1-a"
description = "A basic zonal VM extension policy"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove un-required fields from this example, like description and instance_selectors?


extension_policies {
extension_name = "ops-agent"
pinned_version = "2.66.0"
}

instance_selectors {
label_selector {
inclusion_labels = {
env = "test"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
resource "google_compute_zone_vm_extension_policy" "{{$.PrimaryResourceId}}" {
name = "zonal-ops-agent-vme-policy-%{random_suffix}"
zone = "us-central1-a"
description = "A basic zonal VM extension policy"
priority = 20

extension_policies {
extension_name = "ops-agent"
pinned_version = "2.66.0"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we possibly change the pinned version?

string_config = "logging:\n receivers:\n syslog:\n type: files\n include_paths:\n - /var/log/messages\n"
}

instance_selectors {
label_selector {
inclusion_labels = {
env = "test"
}
}
}
}