Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
eeaton opened this issue May 23, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@eeaton
Copy link
Contributor

eeaton commented May 23, 2024

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

@eeaton eeaton added the bug Something isn't working label May 23, 2024
eeaton added a commit to eeaton/terraform-example-foundation that referenced this issue May 23, 2024
…ules/terraform-google-vm#406

No functional change: leaving most_disruptive_allowed_action blank by default should be equivalent to "REPLACE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
1 participant