| --- |
| # ---------------------------------------------------------------------------- |
| # |
| # *** AUTO GENERATED CODE *** Type: MMv1 *** |
| # |
| # ---------------------------------------------------------------------------- |
| # |
| # This file is automatically generated by Magic Modules and manual |
| # changes will be clobbered when the file is regenerated. |
| # |
| # Please read more about how to change this file in |
| # .github/CONTRIBUTING.md. |
| # |
| # ---------------------------------------------------------------------------- |
| subcategory: "OS Config" |
| description: |- |
| An OS Config resource representing a guest configuration policy. |
| --- |
| |
| # google\_os\_config\_guest\_policies |
| |
| An OS Config resource representing a guest configuration policy. These policies represent |
| the desired state for VM instance guest environments including packages to install or remove, |
| package repository configurations, and software to install. |
| |
| ~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider. |
| See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. |
| |
| To get more information about GuestPolicies, see: |
| |
| * [API documentation](https://cloud.google.com/compute/docs/osconfig/rest) |
| * How-to Guides |
| * [Official Documentation](https://cloud.google.com/compute/docs/os-config-management) |
| |
| <div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=os_config_guest_policies_basic&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank"> |
| <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| </a> |
| </div> |
| ## Example Usage - Os Config Guest Policies Basic |
| |
| |
| ```hcl |
| data "google_compute_image" "my_image" { |
| provider = google-beta |
| family = "debian-11" |
| project = "debian-cloud" |
| } |
| |
| resource "google_compute_instance" "foobar" { |
| provider = google-beta |
| name = "guest-policy-inst" |
| machine_type = "e2-medium" |
| zone = "us-central1-a" |
| can_ip_forward = false |
| tags = ["foo", "bar"] |
| |
| boot_disk { |
| initialize_params { |
| image = data.google_compute_image.my_image.self_link |
| } |
| } |
| |
| network_interface { |
| network = "default" |
| } |
| |
| metadata = { |
| foo = "bar" |
| } |
| } |
| |
| resource "google_os_config_guest_policies" "guest_policies" { |
| provider = google-beta |
| guest_policy_id = "guest-policy" |
| |
| assignment { |
| instances = [google_compute_instance.foobar.id] |
| } |
| |
| packages { |
| name = "my-package" |
| desired_state = "UPDATED" |
| } |
| } |
| ``` |
| <div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=os_config_guest_policies_packages&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank"> |
| <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| </a> |
| </div> |
| ## Example Usage - Os Config Guest Policies Packages |
| |
| |
| ```hcl |
| resource "google_os_config_guest_policies" "guest_policies" { |
| provider = google-beta |
| guest_policy_id = "guest-policy" |
| |
| assignment { |
| group_labels { |
| labels = { |
| color = "red", |
| env = "test" |
| } |
| } |
| |
| group_labels { |
| labels = { |
| color = "blue", |
| env = "test" |
| } |
| } |
| } |
| |
| packages { |
| name = "my-package" |
| desired_state = "INSTALLED" |
| } |
| |
| packages { |
| name = "bad-package-1" |
| desired_state = "REMOVED" |
| } |
| |
| packages { |
| name = "bad-package-2" |
| desired_state = "REMOVED" |
| manager = "APT" |
| } |
| |
| package_repositories { |
| apt { |
| uri = "https://packages.cloud.google.com/apt" |
| archive_type = "DEB" |
| distribution = "cloud-sdk-stretch" |
| components = ["main"] |
| } |
| } |
| |
| package_repositories { |
| yum { |
| id = "google-cloud-sdk" |
| display_name = "Google Cloud SDK" |
| base_url = "https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64" |
| gpg_keys = ["https://packages.cloud.google.com/yum/doc/yum-key.gpg", "https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg"] |
| } |
| } |
| } |
| ``` |
| <div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=os_config_guest_policies_recipes&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank"> |
| <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| </a> |
| </div> |
| ## Example Usage - Os Config Guest Policies Recipes |
| |
| |
| ```hcl |
| resource "google_os_config_guest_policies" "guest_policies" { |
| provider = google-beta |
| guest_policy_id = "guest-policy" |
| |
| assignment { |
| zones = ["us-east1-b", "us-east1-d"] |
| } |
| |
| recipes { |
| name = "guest-policy-recipe" |
| desired_state = "INSTALLED" |
| |
| artifacts { |
| id = "guest-policy-artifact-id" |
| |
| gcs { |
| bucket = "my-bucket" |
| object = "executable.msi" |
| generation = 1546030865175603 |
| } |
| } |
| |
| install_steps { |
| msi_installation { |
| artifact_id = "guest-policy-artifact-id" |
| } |
| } |
| } |
| } |
| ``` |
| |
| ## Argument Reference |
| |
| The following arguments are supported: |
| |
| |
| * `assignment` - |
| (Required) |
| Specifies the VM instances that are assigned to this policy. This allows you to target sets |
| or groups of VM instances by different parameters such as labels, names, OS, or zones. |
| If left empty, all VM instances underneath this policy are targeted. |
| At the same level in the resource hierarchy (that is within a project), the service prevents |
| the creation of multiple policies that conflict with each other. |
| For more information, see how the service |
| [handles assignment conflicts](https://cloud.google.com/compute/docs/os-config-management/create-guest-policy#handle-conflicts). |
| Structure is [documented below](#nested_assignment). |
| |
| * `guest_policy_id` - |
| (Required) |
| The logical name of the guest policy in the project with the following restrictions: |
| * Must contain only lowercase letters, numbers, and hyphens. |
| * Must start with a letter. |
| * Must be between 1-63 characters. |
| * Must end with a number or a letter. |
| * Must be unique within the project. |
| |
| |
| <a name="nested_assignment"></a>The `assignment` block supports: |
| |
| * `group_labels` - |
| (Optional) |
| Targets instances matching at least one of these label sets. This allows an assignment to target disparate groups, |
| for example "env=prod or env=staging". |
| Structure is [documented below](#nested_group_labels). |
| |
| * `zones` - |
| (Optional) |
| Targets instances in any of these zones. Leave empty to target instances in any zone. |
| Zonal targeting is uncommon and is supported to facilitate the management of changes by zone. |
| |
| * `instances` - |
| (Optional) |
| Targets any of the instances specified. Instances are specified by their URI in the form |
| zones/[ZONE]/instances/[INSTANCE_NAME]. |
| Instance targeting is uncommon and is supported to facilitate the management of changes |
| by the instance or to target specific VM instances for development and testing. |
| Only supported for project-level policies and must reference instances within this project. |
| |
| * `instance_name_prefixes` - |
| (Optional) |
| Targets VM instances whose name starts with one of these prefixes. |
| Like labels, this is another way to group VM instances when targeting configs, |
| for example prefix="prod-". |
| Only supported for project-level policies. |
| |
| * `os_types` - |
| (Optional) |
| Targets VM instances matching at least one of the following OS types. |
| VM instances must match all supplied criteria for a given OsType to be included. |
| Structure is [documented below](#nested_os_types). |
| |
| |
| <a name="nested_group_labels"></a>The `group_labels` block supports: |
| |
| * `labels` - |
| (Required) |
| Google Compute Engine instance labels that must be present for an instance to be included in this assignment group. |
| |
| <a name="nested_os_types"></a>The `os_types` block supports: |
| |
| * `os_short_name` - |
| (Optional) |
| Targets VM instances with OS Inventory enabled and having the following OS short name, for example "debian" or "windows". |
| |
| * `os_version` - |
| (Optional) |
| Targets VM instances with OS Inventory enabled and having the following following OS version. |
| |
| * `os_architecture` - |
| (Optional) |
| Targets VM instances with OS Inventory enabled and having the following OS architecture. |
| |
| - - - |
| |
| |
| * `description` - |
| (Optional) |
| Description of the guest policy. Length of the description is limited to 1024 characters. |
| |
| * `packages` - |
| (Optional) |
| The software packages to be managed by this policy. |
| Structure is [documented below](#nested_packages). |
| |
| * `package_repositories` - |
| (Optional) |
| A list of package repositories to configure on the VM instance. |
| This is done before any other configs are applied so they can use these repos. |
| Package repositories are only configured if the corresponding package manager(s) are available. |
| Structure is [documented below](#nested_package_repositories). |
| |
| * `recipes` - |
| (Optional) |
| A list of Recipes to install on the VM instance. |
| Structure is [documented below](#nested_recipes). |
| |
| * `etag` - |
| (Optional) |
| The etag for this guest policy. If this is provided on update, it must match the server's etag. |
| |
| * `project` - (Optional) The ID of the project in which the resource belongs. |
| If it is not provided, the provider project is used. |
| |
| |
| <a name="nested_packages"></a>The `packages` block supports: |
| |
| * `name` - |
| (Required) |
| The name of the package. A package is uniquely identified for conflict validation |
| by checking the package name and the manager(s) that the package targets. |
| |
| * `desired_state` - |
| (Optional) |
| The desiredState the agent should maintain for this package. The default is to ensure the package is installed. |
| Possible values are: `INSTALLED`, `UPDATED`, `REMOVED`. |
| |
| * `manager` - |
| (Optional) |
| Type of package manager that can be used to install this package. If a system does not have the package manager, |
| the package is not installed or removed no error message is returned. By default, or if you specify ANY, |
| the agent attempts to install and remove this package using the default package manager. |
| This is useful when creating a policy that applies to different types of systems. |
| The default behavior is ANY. |
| Default value is `ANY`. |
| Possible values are: `ANY`, `APT`, `YUM`, `ZYPPER`, `GOO`. |
| |
| <a name="nested_package_repositories"></a>The `package_repositories` block supports: |
| |
| * `apt` - |
| (Optional) |
| An Apt Repository. |
| Structure is [documented below](#nested_apt). |
| |
| * `yum` - |
| (Optional) |
| A Yum Repository. |
| Structure is [documented below](#nested_yum). |
| |
| * `zypper` - |
| (Optional) |
| A Zypper Repository. |
| Structure is [documented below](#nested_zypper). |
| |
| * `goo` - |
| (Optional) |
| A Goo Repository. |
| Structure is [documented below](#nested_goo). |
| |
| |
| <a name="nested_apt"></a>The `apt` block supports: |
| |
| * `archive_type` - |
| (Optional) |
| Type of archive files in this repository. The default behavior is DEB. |
| Default value is `DEB`. |
| Possible values are: `DEB`, `DEB_SRC`. |
| |
| * `uri` - |
| (Required) |
| URI for this repository. |
| |
| * `distribution` - |
| (Required) |
| Distribution of this repository. |
| |
| * `components` - |
| (Required) |
| List of components for this repository. Must contain at least one item. |
| |
| * `gpg_key` - |
| (Optional) |
| URI of the key file for this repository. The agent maintains a keyring at |
| /etc/apt/trusted.gpg.d/osconfig_agent_managed.gpg containing all the keys in any applied guest policy. |
| |
| <a name="nested_yum"></a>The `yum` block supports: |
| |
| * `id` - |
| (Required) |
| A one word, unique name for this repository. This is the repo id in the Yum config file and also the displayName |
| if displayName is omitted. This id is also used as the unique identifier when checking for guest policy conflicts. |
| |
| * `display_name` - |
| (Optional) |
| The display name of the repository. |
| |
| * `base_url` - |
| (Required) |
| The location of the repository directory. |
| |
| * `gpg_keys` - |
| (Optional) |
| URIs of GPG keys. |
| |
| <a name="nested_zypper"></a>The `zypper` block supports: |
| |
| * `id` - |
| (Required) |
| A one word, unique name for this repository. This is the repo id in the zypper config file and also the displayName |
| if displayName is omitted. This id is also used as the unique identifier when checking for guest policy conflicts. |
| |
| * `display_name` - |
| (Optional) |
| The display name of the repository. |
| |
| * `base_url` - |
| (Required) |
| The location of the repository directory. |
| |
| * `gpg_keys` - |
| (Optional) |
| URIs of GPG keys. |
| |
| <a name="nested_goo"></a>The `goo` block supports: |
| |
| * `name` - |
| (Required) |
| The name of the repository. |
| |
| * `url` - |
| (Required) |
| The url of the repository. |
| |
| <a name="nested_recipes"></a>The `recipes` block supports: |
| |
| * `name` - |
| (Required) |
| Unique identifier for the recipe. Only one recipe with a given name is installed on an instance. |
| Names are also used to identify resources which helps to determine whether guest policies have conflicts. |
| This means that requests to create multiple recipes with the same name and version are rejected since they |
| could potentially have conflicting assignments. |
| |
| * `version` - |
| (Optional) |
| The version of this software recipe. Version can be up to 4 period separated numbers (e.g. 12.34.56.78). |
| |
| * `artifacts` - |
| (Optional) |
| Resources available to be used in the steps in the recipe. |
| Structure is [documented below](#nested_artifacts). |
| |
| * `install_steps` - |
| (Optional) |
| Actions to be taken for installing this recipe. On failure it stops executing steps and does not attempt another installation. |
| Any steps taken (including partially completed steps) are not rolled back. |
| Structure is [documented below](#nested_install_steps). |
| |
| * `update_steps` - |
| (Optional) |
| Actions to be taken for updating this recipe. On failure it stops executing steps and does not attempt another update for this recipe. |
| Any steps taken (including partially completed steps) are not rolled back. |
| Structure is [documented below](#nested_update_steps). |
| |
| * `desired_state` - |
| (Optional) |
| Default is INSTALLED. The desired state the agent should maintain for this recipe. |
| INSTALLED: The software recipe is installed on the instance but won't be updated to new versions. |
| INSTALLED_KEEP_UPDATED: The software recipe is installed on the instance. The recipe is updated to a higher version, |
| if a higher version of the recipe is assigned to this instance. |
| REMOVE: Remove is unsupported for software recipes and attempts to create or update a recipe to the REMOVE state is rejected. |
| Default value is `INSTALLED`. |
| Possible values are: `INSTALLED`, `UPDATED`, `REMOVED`. |
| |
| |
| <a name="nested_artifacts"></a>The `artifacts` block supports: |
| |
| * `id` - |
| (Required) |
| Id of the artifact, which the installation and update steps of this recipe can reference. |
| Artifacts in a recipe cannot have the same id. |
| |
| * `allow_insecure` - |
| (Optional) |
| Defaults to false. When false, recipes are subject to validations based on the artifact type: |
| Remote: A checksum must be specified, and only protocols with transport-layer security are permitted. |
| GCS: An object generation number must be specified. |
| |
| * `remote` - |
| (Optional) |
| A generic remote artifact. |
| Structure is [documented below](#nested_remote). |
| |
| * `gcs` - |
| (Optional) |
| A Google Cloud Storage artifact. |
| Structure is [documented below](#nested_gcs). |
| |
| |
| <a name="nested_remote"></a>The `remote` block supports: |
| |
| * `uri` - |
| (Optional) |
| URI from which to fetch the object. It should contain both the protocol and path following the format {protocol}://{location}. |
| |
| * `check_sum` - |
| (Optional) |
| Must be provided if allowInsecure is false. SHA256 checksum in hex format, to compare to the checksum of the artifact. |
| If the checksum is not empty and it doesn't match the artifact then the recipe installation fails before running any |
| of the steps. |
| |
| <a name="nested_gcs"></a>The `gcs` block supports: |
| |
| * `bucket` - |
| (Optional) |
| Bucket of the Google Cloud Storage object. Given an example URL: https://storage.googleapis.com/my-bucket/foo/bar#1234567 |
| this value would be my-bucket. |
| |
| * `object` - |
| (Optional) |
| Name of the Google Cloud Storage object. Given an example URL: https://storage.googleapis.com/my-bucket/foo/bar#1234567 |
| this value would be foo/bar. |
| |
| * `generation` - |
| (Optional) |
| Must be provided if allowInsecure is false. Generation number of the Google Cloud Storage object. |
| https://storage.googleapis.com/my-bucket/foo/bar#1234567 this value would be 1234567. |
| |
| <a name="nested_install_steps"></a>The `install_steps` block supports: |
| |
| * `file_copy` - |
| (Optional) |
| Copies a file onto the instance. |
| Structure is [documented below](#nested_file_copy). |
| |
| * `archive_extraction` - |
| (Optional) |
| Extracts an archive into the specified directory. |
| Structure is [documented below](#nested_archive_extraction). |
| |
| * `msi_installation` - |
| (Optional) |
| Installs an MSI file. |
| Structure is [documented below](#nested_msi_installation). |
| |
| * `dpkg_installation` - |
| (Optional) |
| Installs a deb file via dpkg. |
| Structure is [documented below](#nested_dpkg_installation). |
| |
| * `rpm_installation` - |
| (Optional) |
| Installs an rpm file via the rpm utility. |
| Structure is [documented below](#nested_rpm_installation). |
| |
| * `file_exec` - |
| (Optional) |
| Executes an artifact or local file. |
| Structure is [documented below](#nested_file_exec). |
| |
| * `script_run` - |
| (Optional) |
| Runs commands in a shell. |
| Structure is [documented below](#nested_script_run). |
| |
| |
| <a name="nested_file_copy"></a>The `file_copy` block supports: |
| |
| * `artifact_id` - |
| (Required) |
| The id of the relevant artifact in the recipe. |
| |
| * `destination` - |
| (Required) |
| The absolute path on the instance to put the file. |
| |
| * `overwrite` - |
| (Optional) |
| Whether to allow this step to overwrite existing files.If this is false and the file already exists the file |
| is not overwritten and the step is considered a success. Defaults to false. |
| |
| * `permissions` - |
| (Optional) |
| Consists of three octal digits which represent, in order, the permissions of the owner, group, and other users |
| for the file (similarly to the numeric mode used in the linux chmod utility). Each digit represents a three bit |
| number with the 4 bit corresponding to the read permissions, the 2 bit corresponds to the write bit, and the one |
| bit corresponds to the execute permission. Default behavior is 755. |
| Below are some examples of permissions and their associated values: |
| read, write, and execute: 7 read and execute: 5 read and write: 6 read only: 4 |
| |
| <a name="nested_archive_extraction"></a>The `archive_extraction` block supports: |
| |
| * `artifact_id` - |
| (Required) |
| The id of the relevant artifact in the recipe. |
| |
| * `destination` - |
| (Optional) |
| Directory to extract archive to. Defaults to / on Linux or C:\ on Windows. |
| |
| * `type` - |
| (Required) |
| The type of the archive to extract. |
| Possible values are: `TAR`, `TAR_GZIP`, `TAR_BZIP`, `TAR_LZMA`, `TAR_XZ`, `ZIP`. |
| |
| <a name="nested_msi_installation"></a>The `msi_installation` block supports: |
| |
| * `artifact_id` - |
| (Required) |
| The id of the relevant artifact in the recipe. |
| |
| * `flags` - |
| (Optional) |
| The flags to use when installing the MSI. Defaults to the install flag. |
| |
| * `allowed_exit_codes` - |
| (Optional) |
| Return codes that indicate that the software installed or updated successfully. Behaviour defaults to [0] |
| |
| <a name="nested_dpkg_installation"></a>The `dpkg_installation` block supports: |
| |
| * `artifact_id` - |
| (Required) |
| The id of the relevant artifact in the recipe. |
| |
| <a name="nested_rpm_installation"></a>The `rpm_installation` block supports: |
| |
| * `artifact_id` - |
| (Required) |
| The id of the relevant artifact in the recipe. |
| |
| <a name="nested_file_exec"></a>The `file_exec` block supports: |
| |
| * `args` - |
| (Optional) |
| Arguments to be passed to the provided executable. |
| |
| * `allowed_exit_codes` - |
| (Optional) |
| A list of possible return values that the program can return to indicate a success. Defaults to [0]. |
| |
| * `artifact_id` - |
| (Optional) |
| The id of the relevant artifact in the recipe. |
| |
| * `local_path` - |
| (Optional) |
| The absolute path of the file on the local filesystem. |
| |
| <a name="nested_script_run"></a>The `script_run` block supports: |
| |
| * `script` - |
| (Required) |
| The shell script to be executed. |
| |
| * `allowed_exit_codes` - |
| (Optional) |
| Return codes that indicate that the software installed or updated successfully. Behaviour defaults to [0] |
| |
| * `interpreter` - |
| (Optional) |
| The script interpreter to use to run the script. If no interpreter is specified the script is executed directly, |
| which likely only succeed for scripts with shebang lines. |
| Possible values are: `SHELL`, `POWERSHELL`. |
| |
| <a name="nested_update_steps"></a>The `update_steps` block supports: |
| |
| * `file_copy` - |
| (Optional) |
| Copies a file onto the instance. |
| Structure is [documented below](#nested_file_copy). |
| |
| * `archive_extraction` - |
| (Optional) |
| Extracts an archive into the specified directory. |
| Structure is [documented below](#nested_archive_extraction). |
| |
| * `msi_installation` - |
| (Optional) |
| Installs an MSI file. |
| Structure is [documented below](#nested_msi_installation). |
| |
| * `dpkg_installation` - |
| (Optional) |
| Installs a deb file via dpkg. |
| Structure is [documented below](#nested_dpkg_installation). |
| |
| * `rpm_installation` - |
| (Optional) |
| Installs an rpm file via the rpm utility. |
| Structure is [documented below](#nested_rpm_installation). |
| |
| * `file_exec` - |
| (Optional) |
| Executes an artifact or local file. |
| Structure is [documented below](#nested_file_exec). |
| |
| * `script_run` - |
| (Optional) |
| Runs commands in a shell. |
| Structure is [documented below](#nested_script_run). |
| |
| |
| <a name="nested_file_copy"></a>The `file_copy` block supports: |
| |
| * `artifact_id` - |
| (Required) |
| The id of the relevant artifact in the recipe. |
| |
| * `destination` - |
| (Required) |
| The absolute path on the instance to put the file. |
| |
| * `overwrite` - |
| (Optional) |
| Whether to allow this step to overwrite existing files.If this is false and the file already exists the file |
| is not overwritten and the step is considered a success. Defaults to false. |
| |
| * `permissions` - |
| (Optional) |
| Consists of three octal digits which represent, in order, the permissions of the owner, group, and other users |
| for the file (similarly to the numeric mode used in the linux chmod utility). Each digit represents a three bit |
| number with the 4 bit corresponding to the read permissions, the 2 bit corresponds to the write bit, and the one |
| bit corresponds to the execute permission. Default behavior is 755. |
| Below are some examples of permissions and their associated values: |
| read, write, and execute: 7 read and execute: 5 read and write: 6 read only: 4 |
| |
| <a name="nested_archive_extraction"></a>The `archive_extraction` block supports: |
| |
| * `artifact_id` - |
| (Required) |
| The id of the relevant artifact in the recipe. |
| |
| * `destination` - |
| (Optional) |
| Directory to extract archive to. Defaults to / on Linux or C:\ on Windows. |
| |
| * `type` - |
| (Required) |
| The type of the archive to extract. |
| Possible values are: `TAR`, `TAR_GZIP`, `TAR_BZIP`, `TAR_LZMA`, `TAR_XZ`, `ZIP`. |
| |
| <a name="nested_msi_installation"></a>The `msi_installation` block supports: |
| |
| * `artifact_id` - |
| (Required) |
| The id of the relevant artifact in the recipe. |
| |
| * `flags` - |
| (Optional) |
| The flags to use when installing the MSI. Defaults to the install flag. |
| |
| * `allowed_exit_codes` - |
| (Optional) |
| Return codes that indicate that the software installed or updated successfully. Behaviour defaults to [0] |
| |
| <a name="nested_dpkg_installation"></a>The `dpkg_installation` block supports: |
| |
| * `artifact_id` - |
| (Required) |
| The id of the relevant artifact in the recipe. |
| |
| <a name="nested_rpm_installation"></a>The `rpm_installation` block supports: |
| |
| * `artifact_id` - |
| (Required) |
| The id of the relevant artifact in the recipe. |
| |
| <a name="nested_file_exec"></a>The `file_exec` block supports: |
| |
| * `args` - |
| (Optional) |
| Arguments to be passed to the provided executable. |
| |
| * `allowed_exit_codes` - |
| (Optional) |
| A list of possible return values that the program can return to indicate a success. Defaults to [0]. |
| |
| * `artifact_id` - |
| (Optional) |
| The id of the relevant artifact in the recipe. |
| |
| * `local_path` - |
| (Optional) |
| The absolute path of the file on the local filesystem. |
| |
| <a name="nested_script_run"></a>The `script_run` block supports: |
| |
| * `script` - |
| (Required) |
| The shell script to be executed. |
| |
| * `allowed_exit_codes` - |
| (Optional) |
| Return codes that indicate that the software installed or updated successfully. Behaviour defaults to [0] |
| |
| * `interpreter` - |
| (Optional) |
| The script interpreter to use to run the script. If no interpreter is specified the script is executed directly, |
| which likely only succeed for scripts with shebang lines. |
| Possible values are: `SHELL`, `POWERSHELL`. |
| |
| ## Attributes Reference |
| |
| In addition to the arguments listed above, the following computed attributes are exported: |
| |
| * `id` - an identifier for the resource with format `projects/{{project}}/guestPolicies/{{guest_policy_id}}` |
| |
| * `name` - |
| Unique name of the resource in this project using one of the following forms: projects/{project_number}/guestPolicies/{guestPolicyId}. |
| |
| * `create_time` - |
| Time this guest policy was created. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. |
| Example: "2014-10-02T15:01:23.045123456Z". |
| |
| * `update_time` - |
| Last time this guest policy was updated. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. |
| Example: "2014-10-02T15:01:23.045123456Z". |
| |
| |
| ## Timeouts |
| |
| This resource provides the following |
| [Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options: |
| |
| - `create` - Default is 20 minutes. |
| - `update` - Default is 20 minutes. |
| - `delete` - Default is 20 minutes. |
| |
| ## Import |
| |
| |
| GuestPolicies can be imported using any of these accepted formats: |
| |
| * `projects/{{project}}/guestPolicies/{{guest_policy_id}}` |
| * `{{project}}/{{guest_policy_id}}` |
| * `{{guest_policy_id}}` |
| |
| |
| In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import GuestPolicies using one of the formats above. For example: |
| |
| ```tf |
| import { |
| id = "projects/{{project}}/guestPolicies/{{guest_policy_id}}" |
| to = google_os_config_guest_policies.default |
| } |
| ``` |
| |
| When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), GuestPolicies can be imported using one of the formats above. For example: |
| |
| ``` |
| $ terraform import google_os_config_guest_policies.default projects/{{project}}/guestPolicies/{{guest_policy_id}} |
| $ terraform import google_os_config_guest_policies.default {{project}}/{{guest_policy_id}} |
| $ terraform import google_os_config_guest_policies.default {{guest_policy_id}} |
| ``` |
| |
| ## User Project Overrides |
| |
| This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override). |