From 2d6cc6593efc645e839f021ab6843eb319b756f3 Mon Sep 17 00:00:00 2001 From: Francisco Valente Castro <1435136+franciscovalentecastro@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:11:11 -0400 Subject: [PATCH] docs: Add example for ops-agent-policy module README. (#121) --- .../ops_agent_policy_install_all/README.md | 2 +- .../README.md | 2 +- modules/ops-agent-policy/README.md | 32 +++++++++++++++++-- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/examples/ops_agent_policy_install_all/README.md b/examples/ops_agent_policy_install_all/README.md index 273b4e1..b6df21d 100644 --- a/examples/ops_agent_policy_install_all/README.md +++ b/examples/ops_agent_policy_install_all/README.md @@ -1,6 +1,6 @@ # Ops Agent Policy Example -This example illustrates how to use the `ops-agent-policy` module to install the ops agent on all VMs in a zone. +This example illustrates how to use the `ops-agent-policy` module to install the ops agent on all VMs within a GCP project. ## Inputs diff --git a/examples/ops_agent_policy_install_all_in_region/README.md b/examples/ops_agent_policy_install_all_in_region/README.md index 8f8ae29..2c79858 100644 --- a/examples/ops_agent_policy_install_all_in_region/README.md +++ b/examples/ops_agent_policy_install_all_in_region/README.md @@ -1,6 +1,6 @@ # Ops Agent Policy Example -This example illustrates how to use the `ops-agent-policy` module to install the ops agent on all VMs in a zone. +This example illustrates how to use the `ops-agent-policy` module to install the ops agent on all VMs in a region. ## Inputs diff --git a/modules/ops-agent-policy/README.md b/modules/ops-agent-policy/README.md index d98ab88..53b845f 100644 --- a/modules/ops-agent-policy/README.md +++ b/modules/ops-agent-policy/README.md @@ -1,10 +1,38 @@ # Agent Policy -This module is used to install/uninstall the ops agent in GCE. +This module is used to install/uninstall the ops agent in Google Cloud Engine VM's using [ops agent policies](https://cloud.google.com/stackdriver/docs/solutions/agents/ops-agent/agent-policies). ## Usage -Functional examples are included in the [examples](./../../examples) directory. +Basic usage of this module is as follows: + +Sample module to install [Ops Agent](https://cloud.google.com/stackdriver/docs/solutions/ops-agent) on all Debian 12 VMs with the label "goog-ops-agent-policy=enabled". +```hcl +module "ops_agent_policy" { + source = "github.com/terraform-google-modules/terraform-google-cloud-operations/modules/ops-agent-policy" + project = "" + 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](./../../examples) directory with the prefix `ops_agent_policy`. ## Inputs