managed instance group update_policy conflict on required variables
jsumali opened this issue · 2 comments
jsumali commented
TL;DR
On terraform-google-modules/vm/google//modules/mig
, we're unable to set update_policy
since all surge
and unavailable
parameters are required, but the underlying resources say that only one or the other (fixed or percent) should be used.
Expected behavior
This should be valid:
update_policy = [{
type = "PROACTIVE"
instance_redistribution_type = "PROACTIVE"
minimal_action = "REPLACE"
most_disruptive_allowed_action = "REPLACE"
replacement_method = "RECREATE"
max_surge_fixed = 3
max_unavailable_fixed = 0
min_ready_sec = 60
}]
Observed behavior
Error:
│ The given value is not suitable for module.web-mig.var.update_policy declared at .terraform/modules/web-mig/modules/mig/variables.tf:81,1-25: element 0:
│ attributes "max_surge_percent" and "max_unavailable_percent" are required.
If we also specify max_surge_percent
and max_unavailable_percent
, then we get the following errors:
update_policy = [{
type = "PROACTIVE"
instance_redistribution_type = "PROACTIVE"
minimal_action = "REPLACE"
most_disruptive_allowed_action = "REPLACE"
replacement_method = "RECREATE"
max_surge_fixed = 3
max_surge_percent = 50
max_unavailable_fixed = 0
max_unavailable_percent = 0
min_ready_sec = 60
}]
│ "update_policy.0.max_unavailable_percent": conflicts with update_policy.0.max_unavailable_fixed
│ "update_policy.0.max_surge_fixed": conflicts with update_policy.0.max_surge_percent
│ "update_policy.0.max_surge_percent": conflicts with update_policy.0.max_surge_fixed
│ "update_policy.0.max_unavailable_fixed": conflicts with update_policy.0.max_unavailable_percent
Terraform Configuration
module "web-mig" {
source = "terraform-google-modules/vm/google//modules/mig"
instance_template = module.web-instance-template.self_link
project_id = var.project_id
region = var.region
###
distribution_policy_zones = [var.zone]
autoscaling_enabled = true
autoscaling_cpu = [{ "target" = 0.76, predictive_method = "NONE" }]
min_replicas = var.web_public_min_replicas
max_replicas = var.web_public_max_replicas
hostname = "${var.env_prefix}-web-mig"
mig_name = "${var.env_prefix}-web-mig"
named_ports = [{ "name" = "http", "port" = 80 }]
update_policy = [{
type = "PROACTIVE"
instance_redistribution_type = "PROACTIVE"
minimal_action = "REPLACE"
most_disruptive_allowed_action = "REPLACE"
replacement_method = "RECREATE"
max_surge_fixed = 3
max_unavailable_fixed = 0
min_ready_sec = 60
}]
}
### Terraform Version
```sh
$ terraform versio
n
Terraform v1.3.3
on darwin_amd64
+ provider registry.terraform.io/hashicorp/google v4.56.0
+ provider registry.terraform.io/hashicorp/google-beta v4.56.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.18.1
+ provider registry.terraform.io/hashicorp/random v3.4.3
Additional information
No response