This module is used to install/uninstall the ops agent in Google Cloud Engine VM's using ops agent policies.
Basic usage of this module is as follows:
Sample module to install Ops Agent on all Debian 12 VMs with the label "goog-ops-agent-policy=enabled".
module "ops_agent_policy" {
source = "github.com/terraform-google-modules/terraform-google-cloud-operations/modules/ops-agent-policy"
project = "<PROJECT ID>"
zone = "<ZONE>"
assignment_id = "example-ops-agent-policy"
agents_rule = {
package_state = "installed"
version = "latest"
}
instance_filter = {
all = false
inventories = [{
os_short_name = "debian"
os_version = "12"
}]
inclusion_labels = [{
labels = {
goog-ops-agent-policy = "enabled"
}
}]
}
}
Functional examples are included in the examples directory with the prefix ops_agent_policy
.
Name | Description | Type | Default | Required |
---|---|---|---|---|
agents_rule | Whether to install or uninstall the agent, and which version to install. | object({ package_state : string, version : string }) |
{ |
no |
assignment_id | Resource name. Unique among policy assignments in the given zone | string |
n/a | yes |
instance_filter | Filter to select VMs. Structure is documented below here: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/os_config_os_policy_assignment. | object({ |
n/a | yes |
project | The ID of the project in which to provision resources. If not present, uses the provider ID | string |
null |
no |
zone | The location to which policy assignments are applied to. | string |
n/a | yes |
Name | Description |
---|---|
ops_agent_policy | The generated policy for installing/uninstalling the ops agent. |
The GA agent policies public documentation shows different errors that can appear while creating policies using the ops-agent-policy module.