From e7adc2232339dffab70cc7e153b1681d31701c98 Mon Sep 17 00:00:00 2001
From: Wayne <53596635+wayne-root@users.noreply.github.com>
Date: Tue, 17 Jan 2023 14:32:17 +0800
Subject: [PATCH] Fix pre-commit issues (#8)
---
.github/workflows/ci.yml | 8 ++++++++
.pre-commit-config.yaml | 17 ++++++++++++++---
README.md | 2 +-
examples/ec2/README.MD | 4 ++--
examples/fargate/README.MD | 2 +-
modules/autoscaling-policy/README.md | 2 +-
modules/autoscaling-policy/outputs.tf | 16 ++++++++--------
modules/cluster/README.md | 4 ++--
modules/cluster/variables.tf | 2 +-
modules/iam/README.md | 2 +-
modules/service-discovery/README.md | 2 +-
modules/service-discovery/main.tf | 2 +-
modules/service-discovery/outputs.tf | 4 ++--
modules/service/README.md | 2 +-
variables.tf | 2 +-
15 files changed, 45 insertions(+), 26 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e34bbd4..36ed3ae 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -4,6 +4,14 @@ on:
push:
branches:
- main
+
+permissions:
+ actions: read
+ checks: read
+ contents: read
+ pull-requests: write
+ security-events: write
+
jobs:
ci:
uses: SPHTech-Platform/reusable-workflows/.github/workflows/terraform.yaml@main
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index d2ea4c2..ac1aab6 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -2,25 +2,36 @@ repos:
- repo: https://github.com/gruntwork-io/pre-commit
rev: v0.1.17
hooks:
- - id: markdown-link-check
- id: shellcheck
+ - repo: https://github.com/tcort/markdown-link-check
+ rev: v3.9.3
+ hooks:
+ - id: markdown-link-check
+ args:
+ - "--config=mlc_config.json"
+
- repo: https://github.com/antonbabenko/pre-commit-terraform
- rev: v1.72.1
+ rev: v1.77.0
hooks:
- id: terraform_fmt
- id: terraform_validate
+ args:
+ - --hook-config=--retry-once-with-cleanup=true
- id: terraform_tflint
args:
- --args=--module
- --args=--config=__GIT_WORKING_DIR__/.tflint.hcl
- id: terraform_docs
args:
- - "--args=--lockfile=false"
+ - --hook-config=--path-to-file=README.md
+ - --hook-config=--add-to-existing-file=true
+ - --hook-config=--recursive=true
- id: terraform_tfsec
args:
- --args=--exclude-downloaded-modules
- id: terraform_checkov
+
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
diff --git a/README.md b/README.md
index 74cae7f..f29a954 100644
--- a/README.md
+++ b/README.md
@@ -54,7 +54,7 @@ No resources.
| [enable\_execute\_command](#input\_enable\_execute\_command) | Specifies whether to enable Amazon ECS Exec for the tasks within the service | `bool` | `false` | no |
| [launch\_type](#input\_launch\_type) | The launch type on which to run your task.(EC2\|FARGATE) | `string` | `"EC2"` | no |
| [link\_ecs\_to\_asg\_capacity\_provider](#input\_link\_ecs\_to\_asg\_capacity\_provider) | Specify whether to link ECS to autoscaling group capacity provider | `bool` | `false` | no |
-| [name](#input\_name) | Name of the product/project/application | `string` | `null` | no |
+| [name](#input\_name) | Name of the product/project/application | `string` | `""` | no |
| [platform\_version](#input\_platform\_version) | Platform version (applicable for FARGATE launch type) | `string` | `"LATEST"` | no |
| [service\_deployment\_maximum\_percent](#input\_service\_deployment\_maximum\_percent) | Upper limit (as a percentage of the service's desiredCount) of the number of running tasks that can be running in a service during a deployment. Not valid when using the DAEMON scheduling strategy. | `number` | `200` | no |
| [service\_deployment\_minimum\_healthy\_percent](#input\_service\_deployment\_minimum\_healthy\_percent) | Lower limit (as a percentage of the service's desiredCount) of the number of running tasks that must remain running and healthy in a service during a deployment. | `number` | `100` | no |
diff --git a/examples/ec2/README.MD b/examples/ec2/README.MD
index 053acaa..3a1eadd 100644
--- a/examples/ec2/README.MD
+++ b/examples/ec2/README.MD
@@ -11,8 +11,8 @@
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | ~> 4.16 |
-| [local](#provider\_local) | ~> 2.2 |
+| [aws](#provider\_aws) | 4.36.1 |
+| [local](#provider\_local) | 2.2.3 |
## Modules
diff --git a/examples/fargate/README.MD b/examples/fargate/README.MD
index fa31cb7..673f203 100644
--- a/examples/fargate/README.MD
+++ b/examples/fargate/README.MD
@@ -10,7 +10,7 @@
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | ~> 4.16 |
+| [aws](#provider\_aws) | 4.45.0 |
## Modules
diff --git a/modules/autoscaling-policy/README.md b/modules/autoscaling-policy/README.md
index f3a290c..5c57ab9 100644
--- a/modules/autoscaling-policy/README.md
+++ b/modules/autoscaling-policy/README.md
@@ -10,7 +10,7 @@
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 4.0 |
+| [aws](#provider\_aws) | 4.36.1 |
## Modules
diff --git a/modules/autoscaling-policy/outputs.tf b/modules/autoscaling-policy/outputs.tf
index f30de7c..ec3b6e8 100644
--- a/modules/autoscaling-policy/outputs.tf
+++ b/modules/autoscaling-policy/outputs.tf
@@ -1,41 +1,41 @@
output "cpu_autoscaling_arn" {
description = "The ARN assigned by AWS to the scaling policy."
- value = join("", aws_autoscaling_policy.asg_cpu_autoscaling.*.arn)
+ value = join("", aws_autoscaling_policy.asg_cpu_autoscaling[*].arn)
}
output "cpu_autoscaling_name" {
description = "The scaling policy's name."
- value = join("", aws_autoscaling_policy.asg_cpu_autoscaling.*.name)
+ value = join("", aws_autoscaling_policy.asg_cpu_autoscaling[*].name)
}
output "cpu_autoscaling_asg_name" {
description = "The scaling policy's assigned autoscaling group."
- value = join("", aws_autoscaling_policy.asg_cpu_autoscaling.*.autoscaling_group_name)
+ value = join("", aws_autoscaling_policy.asg_cpu_autoscaling[*].autoscaling_group_name)
}
output "cpu_autoscaling_policy_type" {
description = "The scaling policy's type."
- value = join("", aws_autoscaling_policy.asg_cpu_autoscaling.*.policy_type)
+ value = join("", aws_autoscaling_policy.asg_cpu_autoscaling[*].policy_type)
}
output "memory_autoscaling_arn" {
description = "The ARN assigned by AWS to the scaling policy."
- value = join("", aws_autoscaling_policy.asg_memory_autoscaling.*.arn)
+ value = join("", aws_autoscaling_policy.asg_memory_autoscaling[*].arn)
}
output "memory_autoscaling_name" {
description = "The scaling policy's name."
- value = join("", aws_autoscaling_policy.asg_memory_autoscaling.*.name)
+ value = join("", aws_autoscaling_policy.asg_memory_autoscaling[*].name)
}
output "memory_autoscaling_asg_name" {
description = "The scaling policy's assigned autoscaling group."
- value = join("", aws_autoscaling_policy.asg_memory_autoscaling.*.autoscaling_group_name)
+ value = join("", aws_autoscaling_policy.asg_memory_autoscaling[*].autoscaling_group_name)
}
output "memory_autoscaling_policy_type" {
description = "The scaling policy's type."
- value = join("", aws_autoscaling_policy.asg_memory_autoscaling.*.policy_type)
+ value = join("", aws_autoscaling_policy.asg_memory_autoscaling[*].policy_type)
}
output "cpu_policy_arn" {
diff --git a/modules/cluster/README.md b/modules/cluster/README.md
index d35539a..d4d418b 100644
--- a/modules/cluster/README.md
+++ b/modules/cluster/README.md
@@ -10,7 +10,7 @@
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 4.0 |
+| [aws](#provider\_aws) | 4.36.1 |
## Modules
@@ -47,7 +47,7 @@ No modules.
| [log\_group\_name](#input\_log\_group\_name) | Provide name for log group | `string` | `""` | no |
| [log\_retention](#input\_log\_retention) | Specify log retention in days | `number` | `30` | no |
| [managed\_scaling](#input\_managed\_scaling) | Specifies whether to enable managed scaling | `bool` | `true` | no |
-| [name](#input\_name) | Name of the product/project/application | `string` | `null` | no |
+| [name](#input\_name) | Name of the product/project/application | `string` | `""` | no |
| [scaling\_max\_step\_size](#input\_scaling\_max\_step\_size) | Sets managed scaling max step size | `number` | `10` | no |
| [scaling\_min\_step\_size](#input\_scaling\_min\_step\_size) | Sets managed scaling min step size | `number` | `1` | no |
| [scaling\_target\_capacity](#input\_scaling\_target\_capacity) | Sets managed scaling target capacity | `number` | `80` | no |
diff --git a/modules/cluster/variables.tf b/modules/cluster/variables.tf
index 58eb64a..c411ea6 100644
--- a/modules/cluster/variables.tf
+++ b/modules/cluster/variables.tf
@@ -1,7 +1,7 @@
variable "name" {
description = "Name of the product/project/application"
type = string
- default = null
+ default = ""
}
variable "ecs_cluster_name" {
diff --git a/modules/iam/README.md b/modules/iam/README.md
index 779a083..c983ac8 100644
--- a/modules/iam/README.md
+++ b/modules/iam/README.md
@@ -10,7 +10,7 @@
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | ~> 4.0 |
+| [aws](#provider\_aws) | 4.36.1 |
## Modules
diff --git a/modules/service-discovery/README.md b/modules/service-discovery/README.md
index a4a227f..da59d15 100644
--- a/modules/service-discovery/README.md
+++ b/modules/service-discovery/README.md
@@ -10,7 +10,7 @@
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 4.0 |
+| [aws](#provider\_aws) | 4.36.1 |
## Modules
diff --git a/modules/service-discovery/main.tf b/modules/service-discovery/main.tf
index 37f15d2..3f9fbd7 100644
--- a/modules/service-discovery/main.tf
+++ b/modules/service-discovery/main.tf
@@ -12,7 +12,7 @@ resource "aws_service_discovery_service" "this" {
name = each.value
dns_config {
- namespace_id = element(aws_service_discovery_private_dns_namespace.this.*.id, 0)
+ namespace_id = element(aws_service_discovery_private_dns_namespace.this[*].id, 0)
dns_records {
ttl = var.service_discovery_record_ttl
diff --git a/modules/service-discovery/outputs.tf b/modules/service-discovery/outputs.tf
index 5486411..3c66235 100644
--- a/modules/service-discovery/outputs.tf
+++ b/modules/service-discovery/outputs.tf
@@ -1,11 +1,11 @@
output "namespace_id" {
description = "The ID of the namespace that you want to use to create the service."
- value = aws_service_discovery_private_dns_namespace.this.*.id
+ value = aws_service_discovery_private_dns_namespace.this[*].id
}
output "namespace_arn" {
description = "arn of the namespace"
- value = aws_service_discovery_private_dns_namespace.this.*.arn
+ value = aws_service_discovery_private_dns_namespace.this[*].arn
}
output "service_ids" {
diff --git a/modules/service/README.md b/modules/service/README.md
index 8263389..31e026f 100644
--- a/modules/service/README.md
+++ b/modules/service/README.md
@@ -10,7 +10,7 @@
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 4.0 |
+| [aws](#provider\_aws) | 4.36.1 |
## Modules
diff --git a/variables.tf b/variables.tf
index 2adaa5c..cd29a8e 100644
--- a/variables.tf
+++ b/variables.tf
@@ -1,7 +1,7 @@
variable "name" {
description = "Name of the product/project/application"
type = string
- default = null
+ default = ""
}
##############################