Skip to content

Commit 41e2f95

Browse files
committed
Updating to Terraform 0.13
1 parent a3d344a commit 41e2f95

File tree

7 files changed

+32
-27
lines changed

7 files changed

+32
-27
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ version: 2
22
jobs:
33
check-format:
44
docker:
5-
- image: hashicorp/terraform:0.12.29
5+
- image: hashicorp/terraform
66
steps:
77
- checkout
88
- run:
99
command: terraform fmt -check -recursive -diff
1010
validate:
1111
docker:
12-
- image: hashicorp/terraform:0.12.29
12+
- image: hashicorp/terraform
1313
steps:
1414
- checkout
1515
- run:

autoscaling.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# AWS ECS Auto Scale Role
33
#------------------------------------------------------------------------------
44
resource "aws_iam_role" "ecs_autoscale_role" {
5-
name = "${var.name_preffix}-ecs-autoscale-role"
5+
name = "${var.name_prefix}-ecs-autoscale-role"
66
assume_role_policy = file("${path.module}/files/iam/ecs_autoscale_iam_role.json")
77
}
88

99
resource "aws_iam_role_policy" "ecs_autoscale_role_policy" {
10-
name = "${var.name_preffix}-ecs-autoscale-role-policy"
10+
name = "${var.name_prefix}-ecs-autoscale-role-policy"
1111
role = aws_iam_role.ecs_autoscale_role.id
1212
policy = file(
1313
"${path.module}/files/iam/ecs_autoscale_iam_role_policy.json",
@@ -18,7 +18,7 @@ resource "aws_iam_role_policy" "ecs_autoscale_role_policy" {
1818
# AWS Auto Scaling - CloudWatch Alarm CPU High
1919
#------------------------------------------------------------------------------
2020
resource "aws_cloudwatch_metric_alarm" "cpu_high" {
21-
alarm_name = "${var.name_preffix}-cpu-high"
21+
alarm_name = "${var.name_prefix}-cpu-high"
2222
comparison_operator = "GreaterThanOrEqualToThreshold"
2323
evaluation_periods = var.max_cpu_evaluation_period
2424
metric_name = "CPUUtilization"
@@ -37,7 +37,7 @@ resource "aws_cloudwatch_metric_alarm" "cpu_high" {
3737
# AWS Auto Scaling - CloudWatch Alarm CPU Low
3838
#------------------------------------------------------------------------------
3939
resource "aws_cloudwatch_metric_alarm" "cpu_low" {
40-
alarm_name = "${var.name_preffix}-cpu-low"
40+
alarm_name = "${var.name_prefix}-cpu-low"
4141
comparison_operator = "LessThanOrEqualToThreshold"
4242
evaluation_periods = var.min_cpu_evaluation_period
4343
metric_name = "CPUUtilization"
@@ -56,7 +56,7 @@ resource "aws_cloudwatch_metric_alarm" "cpu_low" {
5656
# AWS Auto Scaling - Scaling Up Policy
5757
#------------------------------------------------------------------------------
5858
resource "aws_appautoscaling_policy" "scale_up_policy" {
59-
name = "${var.name_preffix}-scale-up-policy"
59+
name = "${var.name_prefix}-scale-up-policy"
6060
depends_on = [aws_appautoscaling_target.scale_target]
6161
service_namespace = "ecs"
6262
resource_id = "service/${var.ecs_cluster_name}/${aws_ecs_service.service.name}"
@@ -76,7 +76,7 @@ resource "aws_appautoscaling_policy" "scale_up_policy" {
7676
# AWS Auto Scaling - Scaling Down Policy
7777
#------------------------------------------------------------------------------
7878
resource "aws_appautoscaling_policy" "scale_down_policy" {
79-
name = "${var.name_preffix}-scale-down-policy"
79+
name = "${var.name_prefix}-scale-down-policy"
8080
depends_on = [aws_appautoscaling_target.scale_target]
8181
service_namespace = "ecs"
8282
resource_id = "service/${var.ecs_cluster_name}/${aws_ecs_service.service.name}"

examples/test/main.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ provider "aws" {
44

55
module "cluster" {
66
source = "cn-terraform/ecs-cluster/aws"
7-
version = "1.0.5"
7+
version = "1.0.6"
88
name = "test-cluster"
99
}
1010

1111
module "base-network" {
1212
source = "cn-terraform/networking/aws"
13-
version = "2.0.7"
14-
name_preffix = "test-networking"
13+
version = "2.0.10"
14+
name_prefix = "test-networking"
1515
vpc_cidr_block = "192.168.0.0/16"
1616
availability_zones = ["us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d"]
1717
public_subnets_cidrs_per_availability_zone = ["192.168.0.0/19", "192.168.32.0/19", "192.168.64.0/19", "192.168.96.0/19"]
@@ -20,24 +20,24 @@ module "base-network" {
2020

2121
module "load_balancer" {
2222
source = "cn-terraform/ecs-alb/aws"
23-
version = "1.0.2"
24-
name_preffix = "test-alb"
23+
version = "1.0.5"
24+
name_prefix = "test-alb"
2525
vpc_id = module.base-network.vpc_id
2626
private_subnets = module.base-network.private_subnets_ids
2727
public_subnets = module.base-network.public_subnets_ids
2828
}
2929

3030
module "td" {
3131
source = "cn-terraform/ecs-fargate-task-definition/aws"
32-
version = "1.0.11"
33-
name_preffix = "test-td"
32+
version = "1.0.15"
33+
name_prefix = "test-td"
3434
container_image = "ubuntu"
3535
container_name = "test"
3636
}
3737

3838
module "service" {
3939
source = "../../"
40-
name_preffix = "test-service"
40+
name_prefix = "test-service"
4141
vpc_id = module.base-network.vpc_id
4242
ecs_cluster_arn = module.cluster.aws_ecs_cluster_cluster_arn
4343
task_definition_arn = module.td.aws_ecs_task_definition_td_arn

main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ data "aws_lb_listener" "lb_https_listeners" {
3030
# AWS ECS SERVICE
3131
#------------------------------------------------------------------------------
3232
resource "aws_ecs_service" "service" {
33-
name = "${var.name_preffix}-service"
33+
name = "${var.name_prefix}-service"
3434
# capacity_provider_strategy - (Optional) The capacity provider strategy to use for the service. Can be one or more. Defined below.
3535
cluster = var.ecs_cluster_arn
3636
deployment_maximum_percent = var.deployment_maximum_percent
@@ -88,15 +88,15 @@ resource "aws_ecs_service" "service" {
8888
}
8989
task_definition = var.task_definition_arn
9090
tags = {
91-
Name = "${var.name_preffix}-ecs-tasks-sg"
91+
Name = "${var.name_prefix}-ecs-tasks-sg"
9292
}
9393
}
9494

9595
#------------------------------------------------------------------------------
9696
# AWS SECURITY GROUP - ECS Tasks, allow traffic only from Load Balancer
9797
#------------------------------------------------------------------------------
9898
resource "aws_security_group" "ecs_tasks_sg" {
99-
name = "${var.name_preffix}-ecs-tasks-sg"
99+
name = "${var.name_prefix}-ecs-tasks-sg"
100100
description = "Allow inbound access from the LB only"
101101
vpc_id = var.vpc_id
102102
egress {
@@ -106,7 +106,7 @@ resource "aws_security_group" "ecs_tasks_sg" {
106106
cidr_blocks = ["0.0.0.0/0"]
107107
}
108108
tags = {
109-
Name = "${var.name_preffix}-ecs-tasks-sg"
109+
Name = "${var.name_prefix}-ecs-tasks-sg"
110110
}
111111
}
112112

outputs.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ output "aws_ecs_service_service_desired_count" {
2525
# AWS SECURITY GROUPS
2626
#------------------------------------------------------------------------------
2727
output "ecs_tasks_sg_id" {
28-
description = "$${var.name_preffix} ECS Tasks Security Group - The ID of the security group"
28+
description = "$${var.name_prefix} ECS Tasks Security Group - The ID of the security group"
2929
value = aws_security_group.ecs_tasks_sg.id
3030
}
3131

3232
output "ecs_tasks_sg_arn" {
33-
description = "$${var.name_preffix} ECS Tasks Security Group - The ARN of the security group"
33+
description = "$${var.name_prefix} ECS Tasks Security Group - The ARN of the security group"
3434
value = aws_security_group.ecs_tasks_sg.arn
3535
}
3636

3737
output "ecs_tasks_sg_name" {
38-
description = "$${var.name_preffix} ECS Tasks Security Group - The name of the security group"
38+
description = "$${var.name_prefix} ECS Tasks Security Group - The name of the security group"
3939
value = aws_security_group.ecs_tasks_sg.name
4040
}
4141

4242
output "ecs_tasks_sg_description" {
43-
description = "$${var.name_preffix} ECS Tasks Security Group - The description of the security group"
43+
description = "$${var.name_prefix} ECS Tasks Security Group - The description of the security group"
4444
value = aws_security_group.ecs_tasks_sg.description
4545
}
4646

variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#------------------------------------------------------------------------------
22
# Misc
33
#------------------------------------------------------------------------------
4-
variable "name_preffix" {
5-
description = "Name preffix for resources on AWS"
4+
variable "name_prefix" {
5+
description = "Name prefix for resources on AWS"
66
}
77

88
#------------------------------------------------------------------------------

versions.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11

22
terraform {
3-
required_version = ">= 0.12"
3+
required_version = ">= 0.13"
4+
required_providers {
5+
aws = {
6+
source = "hashicorp/aws"
7+
}
8+
}
49
}

0 commit comments

Comments
 (0)