'update_policy' variable for MIG submodule requires parameters that have conflicts.
Opened this issue · 1 comments
TL;DR
Hello there!
I created a Managed Instance Group with module 11.1.0.
After that, I use update_policy
to add configuration for rolling update policy.
Expected behavior
terraform plan
must trigger changes and show changes for update_policy
.
Observed behavior
Get the error:
Error: Invalid value for input variable
│
│ on main.tf line 71, in module "mig":
│ 71: update_policy = [
│ 72: {
│ 73: type = "PROACTIVE"
│ 74: instance_redistribution_type = "PROACTIVE"
│ 75: minimal_action = "REPLACE"
│ 76: most_disruptive_allowed_action = "REPLACE"
│ 77: max_unavailable_fixed = 1
│ 78: max_surge_fixed = 1
│ 79: replacement_method = "SUBSTITUTE"
│ 80: }
│ 81: ]
│
│ The given value is not suitable for module.nonprod_carbon_sunup_mig.var.update_policy declared at .terraform/modules/mig/modules/mig/variables.tf:100,1-25: element 0: attributes "max_surge_percent",
│ "max_unavailable_percent", and "min_ready_sec" are required.
update_policy
variable is defined as:
variable "update_policy" {
description = "The rolling update policy. https://www.terraform.io/docs/providers/google/r/compute_region_instance_group_manager#rolling_update_policy"
type = list(object({
max_surge_fixed = number
instance_redistribution_type = string
max_surge_percent = number
max_unavailable_fixed = number
max_unavailable_percent = number
min_ready_sec = number
replacement_method = string
minimal_action = string
type = string
most_disruptive_allowed_action = string
}))
default = []
}
It means that this variable expects the list of maps where each map contains all these keys.
With respect to the documentation https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_region_instance_group_manager#nested_update_policy we cannot define all keys simultaneously because some of them have conflicts with each other.
Terraform Configuration
module "mig" {
source = "terraform-google-modules/vm/google//modules/mig"
version = "11.1.0"
instance_template = google_compute_instance_template.test_template.self_link
region = "us-central1"
project_id = "test-project"
hostname = "test-hostname"
target_size = 2
distribution_policy_zones = ["us-central1-a", "us-central1-f"]
named_ports = [
{
name = "http"
port = 80
}
]
update_policy = [
{
type = "PROACTIVE"
instance_redistribution_type = "PROACTIVE"
minimal_action = "REPLACE"
most_disruptive_allowed_action = "REPLACE"
max_unavailable_fixed = 1
max_surge_fixed = 1
replacement_method = "SUBSTITUTE"
}
]
}
Terraform Version
v1.4.7
Additional information
No response
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days