From 2699e02eca7c5801183df2cb232c2b4415f7fa1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Taneli=20Lepp=C3=A4?= Date: Tue, 3 Jan 2023 16:23:23 +0100 Subject: [PATCH] Fixed delete_rule in compute-mig module for stateful disks. --- modules/compute-mig/README.md | 54 +++++++++++++++++------------------ modules/compute-mig/main.tf | 2 +- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/modules/compute-mig/README.md b/modules/compute-mig/README.md index ba922670df..2afecbf063 100644 --- a/modules/compute-mig/README.md +++ b/modules/compute-mig/README.md @@ -321,7 +321,7 @@ module "nginx-mig" { } } stateful_disks = { - repd-1 = null + repd-1 = false } } # tftest modules=2 resources=3 @@ -415,34 +415,34 @@ module "nginx-mig" { ## Variables -| name | description | type | required | default | -|---|---|:---:|:---:|:---:| -| [instance_template](variables.tf#L177) | Instance template for the default version. | string | ✓ | | -| [location](variables.tf#L182) | Compute zone or region. | string | ✓ | | -| [name](variables.tf#L187) | Managed group name. | string | ✓ | | -| [project_id](variables.tf#L198) | Project id. | string | ✓ | | -| [all_instances_config](variables.tf#L17) | Metadata and labels set to all instances in the group. | object({…}) | | null | -| [auto_healing_policies](variables.tf#L26) | Auto-healing policies for this group. | object({…}) | | null | -| [autoscaler_config](variables.tf#L35) | Optional autoscaler configuration. | object({…}) | | null | -| [default_version_name](variables.tf#L83) | Name used for the default version. | string | | "default" | -| [description](variables.tf#L89) | Optional description used for all resources managed by this module. | string | | "Terraform managed." | -| [distribution_policy](variables.tf#L95) | DIstribution policy for regional MIG. | object({…}) | | null | -| [health_check_config](variables.tf#L104) | Optional auto-created health check configuration, use the output self-link to set it in the auto healing policy. Refer to examples for usage. | object({…}) | | null | -| [named_ports](variables.tf#L192) | Named ports. | map(number) | | null | -| [stateful_config](variables.tf#L203) | Stateful configuration for individual instances. | map(object({…})) | | {} | -| [stateful_disks](variables.tf#L222) | Stateful disk configuration applied at the MIG level to all instances, in device name => on permanent instance delete rule as boolean. | map(bool) | | {} | -| [target_pools](variables.tf#L229) | Optional list of URLs for target pools to which new instances in the group are added. | list(string) | | [] | -| [target_size](variables.tf#L235) | Group target size, leave null when using an autoscaler. | number | | null | -| [update_policy](variables.tf#L241) | Update policy. Minimal action and type are required. | object({…}) | | null | -| [versions](variables.tf#L262) | Additional application versions, target_size is optional. | map(object({…})) | | {} | -| [wait_for_instances](variables.tf#L275) | Wait for all instances to be created/updated before returning. | object({…}) | | null | +| name | description | type | required | default | +| ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------: | :---------------------------------------: | +| [instance_template](variables.tf#L177) | Instance template for the default version. | string | ✓ | | +| [location](variables.tf#L182) | Compute zone or region. | string | ✓ | | +| [name](variables.tf#L187) | Managed group name. | string | ✓ | | +| [project_id](variables.tf#L198) | Project id. | string | ✓ | | +| [all_instances_config](variables.tf#L17) | Metadata and labels set to all instances in the group. | object({…}) | | null | +| [auto_healing_policies](variables.tf#L26) | Auto-healing policies for this group. | object({…}) | | null | +| [autoscaler_config](variables.tf#L35) | Optional autoscaler configuration. | object({…}) | | null | +| [default_version_name](variables.tf#L83) | Name used for the default version. | string | | "default" | +| [description](variables.tf#L89) | Optional description used for all resources managed by this module. | string | | "Terraform managed." | +| [distribution_policy](variables.tf#L95) | DIstribution policy for regional MIG. | object({…}) | | null | +| [health_check_config](variables.tf#L104) | Optional auto-created health check configuration, use the output self-link to set it in the auto healing policy. Refer to examples for usage. | object({…}) | | null | +| [named_ports](variables.tf#L192) | Named ports. | map(number) | | null | +| [stateful_config](variables.tf#L203) | Stateful configuration for individual instances. | map(object({…})) | | {} | +| [stateful_disks](variables.tf#L222) | Stateful disk configuration applied at the MIG level to all instances, in device name => on permanent instance delete rule as boolean. | map(bool) | | {} | +| [target_pools](variables.tf#L229) | Optional list of URLs for target pools to which new instances in the group are added. | list(string) | | [] | +| [target_size](variables.tf#L235) | Group target size, leave null when using an autoscaler. | number | | null | +| [update_policy](variables.tf#L241) | Update policy. Minimal action and type are required. | object({…}) | | null | +| [versions](variables.tf#L262) | Additional application versions, target_size is optional. | map(object({…})) | | {} | +| [wait_for_instances](variables.tf#L275) | Wait for all instances to be created/updated before returning. | object({…}) | | null | ## Outputs -| name | description | sensitive | -|---|---|:---:| -| [autoscaler](outputs.tf#L17) | Auto-created autoscaler resource. | | -| [group_manager](outputs.tf#L26) | Instance group resource. | | -| [health_check](outputs.tf#L35) | Auto-created health-check resource. | | +| name | description | sensitive | +| ------------------------------- | ----------------------------------- | :-------: | +| [autoscaler](outputs.tf#L17) | Auto-created autoscaler resource. | | +| [group_manager](outputs.tf#L26) | Instance group resource. | | +| [health_check](outputs.tf#L35) | Auto-created health-check resource. | | diff --git a/modules/compute-mig/main.tf b/modules/compute-mig/main.tf index 35f255a682..1c99eadfc2 100644 --- a/modules/compute-mig/main.tf +++ b/modules/compute-mig/main.tf @@ -71,7 +71,7 @@ resource "google_compute_instance_group_manager" "default" { for_each = var.stateful_disks content { device_name = stateful_disk.key - delete_rule = stateful_disk.value + delete_rule = stateful_disk.value ? "ON_PERMANENT_INSTANCE_DELETION" : "NEVER" } }