terraform-google-modules / terraform-google-vm

Provisions VMs in Google Cloud
https://registry.terraform.io/modules/terraform-google-modules/vm/google
Apache License 2.0
220 stars 368 forks source link

"most_disruptive_allowed_action" should be optional for update_policy but is required #406

Closed eeaton closed 1 month ago

eeaton commented 3 months ago

TL;DR

The attribute allow_most_disruptive_action is optional in the Google provider but treated as required in this module.

This blocks upgrades to v11 as seen in this renovate PR: https://github.com/terraform-google-modules/terraform-example-foundation/pull/1126/checks

Expected behavior

The attribute allow_most_disruptive_action should be optional, as stated by the documentation in Google provider

Observed behavior

When using the terraform-google-vm module, allow_most_disruptive_action is required and throws an error if not defined.

terraform_validate ./3-networks-hub-and-spoke/envs/shared ╷ │ Error: Invalid value for input variable │ │ on ../../modules/transitivity/main.tf line 76, in module "migs": │ 76: update_policy = [ │ 77: { │ 78: max_surge_fixed = 4 │ 79: max_surge_percent = null │ 80: instance_redistribution_type = "NONE" │ 81: max_unavailable_fixed = 4 │ 82: max_unavailable_percent = null │ 83: min_ready_sec = 180 │ 84: minimal_action = "RESTART" │ 85: type = "OPPORTUNISTIC" │ 86: replacement_method = "SUBSTITUTE" │ 87: } │ 88: ] │ │ The given value is not suitable for │ module.base_transitivity.module.migs.var.update_policy declared at │ .terraform/modules/base_transitivity.migs/modules/mig/variables.tf:100,1-25: │ element 0: attribute "most_disruptive_allowed_action" is required.

Terraform Configuration

module "migs" {
  source   = "terraform-google-modules/vm/google//modules/mig"
  version  = "~> 11.1"
  for_each = toset(var.regions)

  project_id        = var.project_id
  region            = each.key
  target_size       = 3
  hostname          = "transitivity-gw"
  instance_template = module.templates[each.key].self_link
  update_policy = [
    {
      max_surge_fixed              = 4
      max_surge_percent            = null
      instance_redistribution_type = "NONE"
      max_unavailable_fixed        = 4
      max_unavailable_percent      = null
      min_ready_sec                = 180
      minimal_action               = "RESTART"
      type                         = "OPPORTUNISTIC"
      replacement_method           = "SUBSTITUTE"
    }
  ]
}

Terraform Version

Terraform v1.6.5
on linux_amd64

Additional information

No response

github-actions[bot] commented 1 month ago

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