Skip to content

Commit 873a48f

Browse files
authored
fix: aws_region.current.name is deprecated (#355)
1 parent 6dac3c1 commit 873a48f

File tree

3 files changed

+136
-136
lines changed

3 files changed

+136
-136
lines changed

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ locals {
5555
logDriver = "awslogs"
5656
options = {
5757
"awslogs-group" = local.awslogs_group
58-
"awslogs-region" = data.aws_region.current.name
58+
"awslogs-region" = data.aws_region.current.region
5959
"awslogs-stream-prefix" = "helloworld"
6060
}
6161
}

variables.tf

Lines changed: 134 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,37 @@
1-
variable "name" {
2-
description = "The service name."
3-
type = string
1+
variable "additional_security_group_ids" {
2+
description = "In addition to the security group created for the service, a list of security groups the ECS service should also be added to."
3+
default = []
4+
type = list(string)
45
}
56

6-
variable "availability_zone_rebalancing" {
7-
description = "Allow ECS to automatically rebalance tasks across AZ's"
7+
variable "alb_security_group" {
8+
description = "Application Load Balancer (ALB) security group ID to allow traffic from."
9+
default = ""
810
type = string
9-
default = "DISABLED"
1011
}
1112

12-
variable "environment" {
13-
description = "Environment tag, e.g prod."
14-
type = string
13+
variable "assign_public_ip" {
14+
description = "Whether this instance should be accessible from the public internet. Default is false."
15+
default = false
16+
type = bool
1517
}
1618

17-
variable "cloudwatch_alarm_name" {
18-
description = "Generic name used for CPU and Memory Cloudwatch Alarms"
19-
default = ""
19+
variable "associate_alb" {
20+
description = "Whether to associate an Application Load Balancer (ALB) with the ECS service."
21+
default = false
22+
type = bool
23+
}
24+
25+
variable "associate_nlb" {
26+
description = "Whether to associate a Network Load Balancer (NLB) with the ECS service."
27+
default = false
28+
type = bool
29+
}
30+
31+
variable "availability_zone_rebalancing" {
32+
description = "Allow ECS to automatically rebalance tasks across AZ's"
2033
type = string
34+
default = "DISABLED"
2135
}
2236

2337
variable "cloudwatch_alarm_actions" {
@@ -50,30 +64,41 @@ variable "cloudwatch_alarm_mem_threshold" {
5064
type = number
5165
}
5266

53-
variable "logs_cloudwatch_retention" {
54-
description = "Number of days you want to retain log events in the log group."
55-
default = 90
56-
type = number
67+
variable "cloudwatch_alarm_name" {
68+
description = "Generic name used for CPU and Memory Cloudwatch Alarms"
69+
default = ""
70+
type = string
5771
}
5872

59-
variable "logs_cloudwatch_group" {
60-
description = "CloudWatch log group to create and use. Default: /ecs/{name}-{environment}"
73+
variable "container_definitions" {
74+
description = "Container definitions provided as valid JSON document. Default uses golang:alpine running a simple hello world."
6175
default = ""
6276
type = string
6377
}
6478

79+
variable "container_image" {
80+
description = "The image of the container."
81+
default = "golang:alpine"
82+
type = string
83+
}
84+
85+
variable "container_volumes" {
86+
description = "Volumes that containers in your task may use."
87+
default = []
88+
}
89+
90+
variable "ec2_create_task_execution_role" {
91+
description = "Set to true to create ecs task execution role to ECS EC2 Tasks."
92+
type = bool
93+
default = false
94+
}
95+
6596
variable "ecr_repo_arns" {
6697
description = "The ARNs of the ECR repos. By default, allows all repositories."
6798
type = list(string)
6899
default = ["*"]
69100
}
70101

71-
variable "ecs_use_fargate" {
72-
description = "Whether to use Fargate for the task definition."
73-
default = false
74-
type = bool
75-
}
76-
77102
variable "ecs_cluster" {
78103
description = "ECS cluster object for this task."
79104
type = object({
@@ -82,34 +107,63 @@ variable "ecs_cluster" {
82107
})
83108
}
84109

110+
variable "ecs_deployment_circuit_breaker" {
111+
description = "Configure the ECS deployment circuit breaker"
112+
type = object({
113+
enable = bool
114+
rollback = bool
115+
})
116+
default = {
117+
enable = false
118+
rollback = false
119+
}
120+
}
121+
122+
variable "ecs_exec_enable" {
123+
description = "Enable the ability to execute commands on the containers via Amazon ECS Exec"
124+
default = false
125+
type = bool
126+
}
127+
85128
variable "ecs_instance_role" {
86129
description = "The name of the ECS instance role."
87130
default = ""
88131
type = string
89132
}
90133

91-
variable "ecs_vpc_id" {
92-
description = "VPC ID to be used by ECS."
93-
type = string
94-
}
95-
96134
variable "ecs_subnet_ids" {
97135
description = "Subnet IDs for the ECS tasks."
98136
type = list(string)
99137
}
100138

101-
variable "ec2_create_task_execution_role" {
102-
description = "Set to true to create ecs task execution role to ECS EC2 Tasks."
103-
type = bool
139+
variable "ecs_use_fargate" {
140+
description = "Whether to use Fargate for the task definition."
104141
default = false
142+
type = bool
105143
}
106144

107-
variable "assign_public_ip" {
108-
description = "Whether this instance should be accessible from the public internet. Default is false."
145+
variable "ecs_vpc_id" {
146+
description = "VPC ID to be used by ECS."
147+
type = string
148+
}
149+
150+
variable "efs_instance_id" {
151+
description = "ID of the EFS instance volume"
152+
type = string
153+
default = ""
154+
}
155+
156+
variable "enable_ecs_managed_tags" {
157+
description = "Specifies whether to enable Amazon ECS managed tags for the tasks within the service"
109158
default = false
110159
type = bool
111160
}
112161

162+
variable "environment" {
163+
description = "Environment tag, e.g prod."
164+
type = string
165+
}
166+
113167
variable "fargate_platform_version" {
114168
description = "The platform version on which to run your service. Only applicable when using Fargate launch type."
115169
default = "LATEST"
@@ -128,57 +182,56 @@ variable "fargate_task_memory" {
128182
type = number
129183
}
130184

131-
variable "tasks_desired_count" {
132-
description = "The number of instances of a task definition."
133-
default = 1
134-
type = number
135-
}
136-
137-
variable "tasks_minimum_healthy_percent" {
138-
description = "Lower limit on the number of running tasks."
139-
default = 100
185+
variable "health_check_grace_period_seconds" {
186+
description = "Grace period within which failed health checks will be ignored at container start. Only applies to services with an attached loadbalancer."
187+
default = null
140188
type = number
141189
}
142190

143-
variable "tasks_maximum_percent" {
144-
description = "Upper limit on the number of running tasks."
145-
default = 200
146-
type = number
191+
variable "hello_world_container_ports" {
192+
description = "List of ports for the hello world container app to listen on. The app currently supports listening on two ports."
193+
type = list(number)
194+
default = [8080, 8081]
147195
}
148196

149-
variable "container_image" {
150-
description = "The image of the container."
151-
default = "golang:alpine"
197+
variable "kms_key_id" {
198+
description = "KMS customer managed key (CMK) ARN for encrypting application logs."
152199
type = string
153200
}
154201

155-
variable "container_definitions" {
156-
description = "Container definitions provided as valid JSON document. Default uses golang:alpine running a simple hello world."
157-
default = ""
158-
type = string
202+
variable "lb_target_groups" {
203+
description = "List of load balancer target group objects containing the lb_target_group_arn, container_port and container_health_check_port. The container_port is the port on which the container will receive traffic. The container_health_check_port is an additional port on which the container can receive a health check. The lb_target_group_arn is either Application Load Balancer (ALB) or Network Load Balancer (NLB) target group ARN tasks will register with."
204+
default = []
205+
type = list(
206+
object({
207+
container_port = number
208+
container_health_check_port = number
209+
lb_target_group_arn = string
210+
}
211+
)
212+
)
159213
}
160214

161-
variable "target_container_name" {
162-
description = "Name of the container the Load Balancer should target. Default: {name}-{environment}"
215+
variable "logs_cloudwatch_group" {
216+
description = "CloudWatch log group to create and use. Default: /ecs/{name}-{environment}"
163217
default = ""
164218
type = string
165219
}
166220

167-
variable "associate_alb" {
168-
description = "Whether to associate an Application Load Balancer (ALB) with the ECS service."
169-
default = false
170-
type = bool
221+
variable "logs_cloudwatch_retention" {
222+
description = "Number of days you want to retain log events in the log group."
223+
default = 90
224+
type = number
171225
}
172226

173-
variable "associate_nlb" {
174-
description = "Whether to associate a Network Load Balancer (NLB) with the ECS service."
175-
default = false
227+
variable "manage_ecs_security_group" {
228+
description = "Enable creation and management of the ECS security group and rules"
229+
default = true
176230
type = bool
177231
}
178232

179-
variable "alb_security_group" {
180-
description = "Application Load Balancer (ALB) security group ID to allow traffic from."
181-
default = ""
233+
variable "name" {
234+
description = "The service name."
182235
type = string
183236
}
184237

@@ -188,41 +241,6 @@ variable "nlb_subnet_cidr_blocks" {
188241
type = list(string)
189242
}
190243

191-
variable "kms_key_id" {
192-
description = "KMS customer managed key (CMK) ARN for encrypting application logs."
193-
type = string
194-
}
195-
196-
variable "additional_security_group_ids" {
197-
description = "In addition to the security group created for the service, a list of security groups the ECS service should also be added to."
198-
default = []
199-
type = list(string)
200-
}
201-
202-
variable "lb_target_groups" {
203-
description = "List of load balancer target group objects containing the lb_target_group_arn, container_port and container_health_check_port. The container_port is the port on which the container will receive traffic. The container_health_check_port is an additional port on which the container can receive a health check. The lb_target_group_arn is either Application Load Balancer (ALB) or Network Load Balancer (NLB) target group ARN tasks will register with."
204-
default = []
205-
type = list(
206-
object({
207-
container_port = number
208-
container_health_check_port = number
209-
lb_target_group_arn = string
210-
}
211-
)
212-
)
213-
}
214-
215-
variable "container_volumes" {
216-
description = "Volumes that containers in your task may use."
217-
default = []
218-
}
219-
220-
variable "hello_world_container_ports" {
221-
description = "List of ports for the hello world container app to listen on. The app currently supports listening on two ports."
222-
type = list(number)
223-
default = [8080, 8081]
224-
}
225-
226244
variable "service_registries" {
227245
description = "List of service registry objects as per <https://www.terraform.io/docs/providers/aws/r/ecs_service.html#service_registries-1>. List can only have a single object until <https://github.com/terraform-providers/terraform-provider-aws/issues/9573> is resolved. Either provide container_name and container_port or port"
228246
type = list(object({
@@ -234,44 +252,26 @@ variable "service_registries" {
234252
default = []
235253
}
236254

237-
variable "manage_ecs_security_group" {
238-
description = "Enable creation and management of the ECS security group and rules"
239-
default = true
240-
type = bool
255+
variable "target_container_name" {
256+
description = "Name of the container the Load Balancer should target. Default: {name}-{environment}"
257+
default = ""
258+
type = string
241259
}
242260

243-
variable "health_check_grace_period_seconds" {
244-
description = "Grace period within which failed health checks will be ignored at container start. Only applies to services with an attached loadbalancer."
245-
default = null
261+
variable "tasks_desired_count" {
262+
description = "The number of instances of a task definition."
263+
default = 1
246264
type = number
247265
}
248266

249-
variable "ecs_exec_enable" {
250-
description = "Enable the ability to execute commands on the containers via Amazon ECS Exec"
251-
default = false
252-
type = bool
253-
}
254-
255-
variable "enable_ecs_managed_tags" {
256-
description = "Specifies whether to enable Amazon ECS managed tags for the tasks within the service"
257-
default = false
258-
type = bool
259-
}
260-
261-
variable "ecs_deployment_circuit_breaker" {
262-
description = "Configure the ECS deployment circuit breaker"
263-
type = object({
264-
enable = bool
265-
rollback = bool
266-
})
267-
default = {
268-
enable = false
269-
rollback = false
270-
}
267+
variable "tasks_maximum_percent" {
268+
description = "Upper limit on the number of running tasks."
269+
default = 200
270+
type = number
271271
}
272272

273-
variable "efs_instance_id" {
274-
description = "ID of the EFS instance volume"
275-
type = string
276-
default = ""
273+
variable "tasks_minimum_healthy_percent" {
274+
description = "Lower limit on the number of running tasks."
275+
default = 100
276+
type = number
277277
}

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 4.6.0"
7+
version = "~> 6.0"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)