From 50405fa23bf5111518a224a31ab535ff84de16c8 Mon Sep 17 00:00:00 2001 From: Elliot Date: Thu, 23 May 2024 14:21:41 +0000 Subject: [PATCH 1/3] specify which attributes of update_policy object are optional --- autogen/variables.tf.tmpl | 16 ++++++++-------- examples/mig/full/variables.tf | 16 ++++++++-------- modules/mig/variables.tf | 16 ++++++++-------- modules/mig_with_percent/variables.tf | 16 ++++++++-------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/autogen/variables.tf.tmpl b/autogen/variables.tf.tmpl index 7589746a..324cb280 100644 --- a/autogen/variables.tf.tmpl +++ b/autogen/variables.tf.tmpl @@ -118,16 +118,16 @@ variable "stateful_ips" { 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 + max_surge_fixed = optional(number) + instance_redistribution_type = optional(string) + max_surge_percent = optional(number) + max_unavailable_fixed = optional(number) + max_unavailable_percent = optional(number) + min_ready_sec = optional(number) + replacement_method = optional(string) minimal_action = string type = string - most_disruptive_allowed_action = string + most_disruptive_allowed_action = optional(string) })) default = [] } diff --git a/examples/mig/full/variables.tf b/examples/mig/full/variables.tf index fb875961..c60a0c94 100644 --- a/examples/mig/full/variables.tf +++ b/examples/mig/full/variables.tf @@ -169,16 +169,16 @@ variable "distribution_policy_zones" { 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 + max_surge_fixed = optional(number) + instance_redistribution_type = optional(string) + max_surge_percent = optional(number) + max_unavailable_fixed = optional(number) + max_unavailable_percent = optional(number) + min_ready_sec = optional(number) + replacement_method = optional(string) minimal_action = string type = string - most_disruptive_allowed_action = string + most_disruptive_allowed_action = optional(string) })) default = [] } diff --git a/modules/mig/variables.tf b/modules/mig/variables.tf index e440ee2e..42fd903f 100644 --- a/modules/mig/variables.tf +++ b/modules/mig/variables.tf @@ -100,16 +100,16 @@ variable "stateful_ips" { 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 + max_surge_fixed = optional(number) + instance_redistribution_type = optional(string) + max_surge_percent = optional(number) + max_unavailable_fixed = optional(number) + max_unavailable_percent = optional(number) + min_ready_sec = optional(number) + replacement_method = optional(string) minimal_action = string type = string - most_disruptive_allowed_action = string + most_disruptive_allowed_action = optional(string) })) default = [] } diff --git a/modules/mig_with_percent/variables.tf b/modules/mig_with_percent/variables.tf index 759cd9de..40af6859 100644 --- a/modules/mig_with_percent/variables.tf +++ b/modules/mig_with_percent/variables.tf @@ -110,16 +110,16 @@ variable "stateful_ips" { 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 + max_surge_fixed = optional(number) + instance_redistribution_type = optional(string) + max_surge_percent = optional(number) + max_unavailable_fixed = optional(number) + max_unavailable_percent = optional(number) + min_ready_sec = optional(number) + replacement_method = optional(string) minimal_action = string type = string - most_disruptive_allowed_action = string + most_disruptive_allowed_action = optional(string) })) default = [] } From d7e86acbc884c190caa476fa4827584cd78b962f Mon Sep 17 00:00:00 2001 From: Elliot Date: Thu, 23 May 2024 14:26:53 +0000 Subject: [PATCH 2/3] regenerate metadata and documentation with `make build` --- modules/mig/README.md | 2 +- modules/mig/metadata.yaml | 16 ++++++++-------- modules/mig_with_percent/README.md | 2 +- modules/mig_with_percent/metadata.yaml | 16 ++++++++-------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/modules/mig/README.md b/modules/mig/README.md index 216bcaa3..baace6dc 100644 --- a/modules/mig/README.md +++ b/modules/mig/README.md @@ -45,7 +45,7 @@ The current version is 2.X. The following guides are available to assist with up | stateful\_ips | Statful IPs created on the instances that will be preserved on instance delete. https://cloud.google.com/compute/docs/instance-groups/configuring-stateful-ip-addresses-in-migs |
list(object({
interface_name = string
delete_rule = string
is_external = bool
}))
| `[]` | no | | target\_pools | The target load balancing pools to assign this group to. | `list(string)` | `[]` | no | | target\_size | The target number of running instances for this managed instance group. This value should always be explicitly set unless this resource is attached to an autoscaler, in which case it should never be set. | `number` | `1` | no | -| update\_policy | The rolling update policy. https://www.terraform.io/docs/providers/google/r/compute_region_instance_group_manager#rolling_update_policy |
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
}))
| `[]` | no | +| update\_policy | The rolling update policy. https://www.terraform.io/docs/providers/google/r/compute_region_instance_group_manager#rolling_update_policy |
list(object({
max_surge_fixed = optional(number)
instance_redistribution_type = optional(string)
max_surge_percent = optional(number)
max_unavailable_fixed = optional(number)
max_unavailable_percent = optional(number)
min_ready_sec = optional(number)
replacement_method = optional(string)
minimal_action = string
type = string
most_disruptive_allowed_action = optional(string)
}))
| `[]` | no | | wait\_for\_instances | Whether to wait for all instances to be created/updated before returning. Note that if this is set to true and the operation does not succeed, Terraform will continue trying until it times out. | `string` | `"false"` | no | ## Outputs diff --git a/modules/mig/metadata.yaml b/modules/mig/metadata.yaml index b53348a7..9d12839c 100644 --- a/modules/mig/metadata.yaml +++ b/modules/mig/metadata.yaml @@ -257,16 +257,16 @@ spec: description: The rolling update policy. https://www.terraform.io/docs/providers/google/r/compute_region_instance_group_manager#rolling_update_policy varType: |- 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 + max_surge_fixed = optional(number) + instance_redistribution_type = optional(string) + max_surge_percent = optional(number) + max_unavailable_fixed = optional(number) + max_unavailable_percent = optional(number) + min_ready_sec = optional(number) + replacement_method = optional(string) minimal_action = string type = string - most_disruptive_allowed_action = string + most_disruptive_allowed_action = optional(string) })) defaultValue: [] - name: wait_for_instances diff --git a/modules/mig_with_percent/README.md b/modules/mig_with_percent/README.md index 5e10aec7..4f03d687 100644 --- a/modules/mig_with_percent/README.md +++ b/modules/mig_with_percent/README.md @@ -46,7 +46,7 @@ The current version is 2.X. The following guides are available to assist with up | stateful\_ips | Statful IPs created on the instances that will be preserved on instance delete. https://cloud.google.com/compute/docs/instance-groups/configuring-stateful-ip-addresses-in-migs |
list(object({
interface_name = string
delete_rule = string
is_external = bool
}))
| `[]` | no | | target\_pools | The target load balancing pools to assign this group to. | `list(string)` | `[]` | no | | target\_size | The target number of running instances for this managed instance group. This value should always be explicitly set unless this resource is attached to an autoscaler, in which case it should never be set. | `number` | `1` | no | -| update\_policy | The rolling update policy. https://www.terraform.io/docs/providers/google/r/compute_region_instance_group_manager#rolling_update_policy |
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
}))
| `[]` | no | +| update\_policy | The rolling update policy. https://www.terraform.io/docs/providers/google/r/compute_region_instance_group_manager#rolling_update_policy |
list(object({
max_surge_fixed = optional(number)
instance_redistribution_type = optional(string)
max_surge_percent = optional(number)
max_unavailable_fixed = optional(number)
max_unavailable_percent = optional(number)
min_ready_sec = optional(number)
replacement_method = optional(string)
minimal_action = string
type = string
most_disruptive_allowed_action = optional(string)
}))
| `[]` | no | | wait\_for\_instances | Whether to wait for all instances to be created/updated before returning. Note that if this is set to true and the operation does not succeed, Terraform will continue trying until it times out. | `string` | `"false"` | no | ## Outputs diff --git a/modules/mig_with_percent/metadata.yaml b/modules/mig_with_percent/metadata.yaml index e0fab86a..c2293a5a 100644 --- a/modules/mig_with_percent/metadata.yaml +++ b/modules/mig_with_percent/metadata.yaml @@ -265,16 +265,16 @@ spec: description: The rolling update policy. https://www.terraform.io/docs/providers/google/r/compute_region_instance_group_manager#rolling_update_policy varType: |- 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 + max_surge_fixed = optional(number) + instance_redistribution_type = optional(string) + max_surge_percent = optional(number) + max_unavailable_fixed = optional(number) + max_unavailable_percent = optional(number) + min_ready_sec = optional(number) + replacement_method = optional(string) minimal_action = string type = string - most_disruptive_allowed_action = string + most_disruptive_allowed_action = optional(string) })) defaultValue: [] - name: wait_for_instances From 06304dc9dcb2e6c0ee6f90d8cf3f3a878041f30b Mon Sep 17 00:00:00 2001 From: Elliot Date: Thu, 23 May 2024 15:43:50 +0000 Subject: [PATCH 3/3] bump terraform minimum version to 1.3 to support optional arguments --- autogen/versions.tf.tmpl | 2 +- modules/mig/metadata.yaml | 2 +- modules/mig/versions.tf | 2 +- modules/mig_with_percent/metadata.yaml | 2 +- modules/mig_with_percent/versions.tf | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/autogen/versions.tf.tmpl b/autogen/versions.tf.tmpl index 5464f589..ace24c91 100644 --- a/autogen/versions.tf.tmpl +++ b/autogen/versions.tf.tmpl @@ -15,7 +15,7 @@ */ terraform { - required_version = ">=0.13.0" + required_version = ">=1.3.0" required_providers { google = { source = "hashicorp/google" diff --git a/modules/mig/metadata.yaml b/modules/mig/metadata.yaml index 9d12839c..31fd6d7a 100644 --- a/modules/mig/metadata.yaml +++ b/modules/mig/metadata.yaml @@ -28,7 +28,7 @@ spec: version: 11.1.0 actuationTool: flavor: Terraform - version: ">=0.13.0" + version: ">=1.3.0" description: {} content: examples: diff --git a/modules/mig/versions.tf b/modules/mig/versions.tf index 20c07d24..fbb10041 100644 --- a/modules/mig/versions.tf +++ b/modules/mig/versions.tf @@ -15,7 +15,7 @@ */ terraform { - required_version = ">=0.13.0" + required_version = ">=1.3.0" required_providers { google = { source = "hashicorp/google" diff --git a/modules/mig_with_percent/metadata.yaml b/modules/mig_with_percent/metadata.yaml index c2293a5a..ba7e9b66 100644 --- a/modules/mig_with_percent/metadata.yaml +++ b/modules/mig_with_percent/metadata.yaml @@ -28,7 +28,7 @@ spec: version: 11.1.0 actuationTool: flavor: Terraform - version: ">=0.13.0" + version: ">=1.3.0" description: {} content: examples: diff --git a/modules/mig_with_percent/versions.tf b/modules/mig_with_percent/versions.tf index 0b4c836e..50d2a6f5 100644 --- a/modules/mig_with_percent/versions.tf +++ b/modules/mig_with_percent/versions.tf @@ -15,7 +15,7 @@ */ terraform { - required_version = ">=0.13.0" + required_version = ">=1.3.0" required_providers { google = { source = "hashicorp/google"