8000 fix: missing optional values for variables · infraspecdev/terraform-aws-ecs@beadb18 · GitHub
[go: up one dir, main page]

Skip to content

Commit beadb18

Browse files
committed
fix: missing optional values for variables
Add nullable flags to variables.
1 parent 8845b37 commit beadb18

File tree

1 file changed

+30
-15
lines changed

1 file changed

+30
-15
lines changed

variables.tf

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
variable "cluster_name" {
22
description = "(Required) Name of the cluster"
33
type = string
4+
nullable = false
45
}
56

67
variable "cluster_service_connect_namespace" {
@@ -15,12 +16,14 @@ variable "cluster_setting" {
1516
name = string
1617
value = string
1718
}))
18-
default = []
19+
nullable = false
20+
default = []
1921
}
2022

2123
variable "cluster_tags" {
2224
description = "(Optional) Key-value map of resource tags."
2325
type = map(string)
26+
nullable = false
2427
default = {}
2528
}
2629

@@ -31,11 +34,14 @@ variable "cluster_tags" {
3134
variable "asg_name" {
3235
description = "(Optional) Name of the Auto Scaling Group."
3336
type = string
37+
default = null
3438
}
3539

3640
variable "asg_vpc_zone_identifier" {
3741
description = "(Optional) List of subnet IDs to launch resources in."
3842
type = list(string)
43+
nullable = false
44+
default = []
3945

4046
validation {
4147
condition = alltrue([for subnet_id in var.asg_vpc_zone_identifier : startswith(subnet_id, "subnet-")])
@@ -48,7 +54,7 @@ variable "asg_desired_capacity" {
4854
type = number
4955

5056
validation {
51-
condition = var.asg_desired_capacity >= 0
57+
condition = try(var.asg_desired_capacity >= 0, true)
5258
error_message = "Specified desired capacity must be a valid non-negative number."
5359
}
5460
}
@@ -58,7 +64,7 @@ variable "asg_min_size" {
5864
type = number
5965

6066
validation {
61-
condition = var.asg_min_size >= 0
67+
condition = try(var.asg_min_size >= 0, true)
6268
error_message = "Specified min. size must be a valid non-negative number."
6369
}
6470
}
@@ -68,39 +74,50 @@ variable "asg_max_size" {
6874
type = number
6975

7076
validation {
71-
condition = var.asg_max_size >= 0
77+
condition = try(var.asg_max_size >= 0, null)
7278
error_message = "Specified max. size must be a valid non-negative number."
7379
}
7480
}
7581

7682
variable "asg_protect_from_scale_in" {
7783
description = " (Optional) Whether newly launched instances are automatically protected from termination by Amazon EC2 Auto Scaling when scaling in."
7884
type = bool
79-
default = null
85+
nullable = false
86+
default = false
8087
}
8188

8289
variable "asg_health_check_type" {
8390
description = "(Optional) \"EC2\" or \"ELB\". Controls how health checking is done."
8491
type = string
85-
default = null
92+
nullable = false
93+
default = "EC2"
8694
}
8795

8896
variable "asg_instances_tags" {
8997
description = "Resources Tags to propagate to the Instances"
9098
type = map(string)
99+
nullable = false
9110 EDBE 0
default = {}
92101
}
93102

94103
variable "asg_tags" {
95104
description = "Resources Tags for Autoscaling group"
96105
type = map(string)
106+
nullable = false
97107
default = {}
98108
}
99109

100110
################################################################################
101111
### Launch Template
102112
################################################################################
103113

114+
variable "asg_create_launch_template" {
115+
description = "Either to create a Launch Template to associate with the Autoscaling group"
116+
type = bool
117+
nullable = false
118+
default = true
119+
}
120+
104121
variable "asg_launch_template" {
105122
description = "Launch Template to use with the Autoscaling group"
106123
type = object({
@@ -123,13 +140,8 @@ variable "asg_launch_template" {
123140
user_data = optional(string, null)
124141
tags = optional(map(string), {})
125142
})
126-
default = {}
127-
}
128-
129-
variable "asg_create_launch_template" {
130-
description = "Either to create a Launch Template to associate with the Autoscaling group"
131-
type = bool
132-
default = true
143+
nullable = false
144+
default = {}
133145
}
134146

135147
variable "asg_launch_template_id" {
@@ -146,7 +158,7 @@ variable "asg_launch_template_id" {
146158
variable "asg_launch_template_version" {
147159
description = "(Optional) Template version."
148160
type = string
149-
default = null
161+
default = "$Default"
150162
}
151163

152164
################################################################################
@@ -160,8 +172,9 @@ variable "asg_iam_role_name" {
160172
}
161173

162174
variable "asg_iam_role_policy_attachments" {
163-
description = "(Required) - The ARN of the policy you want to apply"
175+
description = "(Optional) - The ARNs of the policies you want to apply"
164176
type = list(string)
177+
nullable = false
165178
default = [
166179
"arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role"
167180
]
@@ -170,6 +183,7 @@ variable "asg_iam_role_policy_attachments" {
170183
variable "asg_iam_role_tags" {
171184
description = "Key-value mapping of tags for the IAM role."
172185
type = map(string)
186+
nullable = false
173187
default = {}
174188
}
175189

@@ -186,5 +200,6 @@ variable "asg_iam_instance_profile_name" {
186200
variable "asg_iam_instance_profile_tags" {
187201
description = "(Optional) Map of resource tags for the IAM Instance Profile."
188202
type = map(string)
203+
nullable = false
189204
default = {}
190205
}

0 commit comments

Comments
 (0)
0