terraform-example-foundation
terraform-example-foundation copied to clipboard
Missing mandatory update_policy attribute in 3-networks-hub-and-spoke/modules/transitivity/main.tf
TL;DR
terraform plan fails as per below
[myself@linuxbox 3-networks-hub-and-spoke]# ./tf-wrapper.sh plan shared *************** TERRAFORM PLAN ******************* At environment: envs/shared
Error: Invalid value for input variable
on ../../modules/transitivity/main.tf line 76, in module "migs": 76: update_policy = [
The given value is not suitable for module.base_transitivity.module.migs.var.update_policy declared at ../../../terraform-google-modules/vm/google/modules/mig/variables.tf:100,1-25: element 0: attribute "most_disruptive_allowed_action" is required.
Expected behavior
terraform plan should succeed
The attribute should either be provided or marked as optional in terraform-google-modules/vm/google/modules/mig/variables.tf : variable "update_policy" { ... type = list(object({ ...
Observed behavior
terraform plan fails [myself@linuxbox 3-networks-hub-and-spoke]# ./tf-wrapper.sh plan shared *************** TERRAFORM PLAN ******************* At environment: envs/shared
Error: Invalid value for input variable
on ../../modules/transitivity/main.tf line 76, in module "migs": 76: update_policy = [
The given value is not suitable for module.base_transitivity.module.migs.var.update_policy declared at ../../../terraform-google-modules/vm/google/modules/mig/variables.tf:100,1-25: element 0: attribute "most_disruptive_allowed_action" is required.
Terraform Configuration
N/A
Terraform Version
Terraform v1.6.0
on linux_amd64
Your version of Terraform is out of date! The latest version
is 1.7.5. You can update by downloading from https://www.terraform.io/downloads.html
Additional information
Very easy (tested) fix - simply add the attribute in 3-networks-hub-and-spoke/modules/transitivity/main.tf
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" most_disruptive_allowed_action = null <<<=== added }