-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Added Resource google_compute_zonal_vm_extension_policy
#18019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
XuechunHou
wants to merge
3
commits into
GoogleCloudPlatform:main
Choose a base branch
from
XuechunHou:zonal-vme-yaml
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+151
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
1 change: 1 addition & 0 deletions
1
mmv1/templates/terraform/pre_update/vm_extension_policy_name.go.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| obj["name"] = d.Get("name").(string) | ||
18 changes: 18 additions & 0 deletions
18
...mplates/terraform/samples/services/compute/compute_zone_vm_extension_policy_basic.tf.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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" | ||
| } | ||
| } | ||
| } | ||
| } | ||
20 changes: 20 additions & 0 deletions
20
...plates/terraform/samples/services/compute/compute_zone_vm_extension_policy_update.tf.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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" | ||
| } | ||
| } | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.