Skip to content

Commit 3c79ac6

Browse files
authored
Merge pull request #16 from optiop/feature/terraform-linter
Feature/terraform linter
2 parents 1690a40 + b99afee commit 3c79ac6

File tree

5 files changed

+39
-7
lines changed

5 files changed

+39
-7
lines changed

.github/workflows/linter.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Linters and formatters
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Terraform linter
19+
run: |
20+
terraform version
21+
results=$(find . -type f -name "*.tf" ! -path "*/.terraform/*" -exec terraform fmt -check {} \;)
22+
if [ -n "$results" ]; then
23+
echo "Terraform files must be formatted with 'terraform fmt'. Please run 'terraform fmt' and commit the changes."
24+
echo "$results"
25+
exit 1
26+
fi

ops/ecs/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module "cluster" {
1414

1515
module "grafana" {
1616
source = "./modules/grafana"
17-
repository_name = "postgres-grafana-on-ecs-grafana-repo"
17+
repository_name = "postgres-grafana-on-ecs-grafana-repo"
1818
cluster_id = module.cluster.cluster_id
1919
vpc_id = module.vpc.vpc_id
2020
vpc_public_subnets = module.vpc.public_subnets
@@ -27,7 +27,7 @@ module "grafana" {
2727

2828
module "postgres" {
2929
source = "./modules/postgres"
30-
repository_name = "postgres-grafana-on-ecs-postgres-repo"
30+
repository_name = "postgres-grafana-on-ecs-postgres-repo"
3131
cluster_id = module.cluster.cluster_id
3232
vpc_id = module.vpc.vpc_id
3333
vpc_public_subnets = module.vpc.public_subnets

ops/ecs/modules/cluster/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Cluster Module
2+
3+
## Providers
4+
| Name | Version |
5+
|------|---------|
6+
| aws | ~ 5.7.0 |

ops/ecs/modules/grafana/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ resource "aws_ecs_task_definition" "task" {
2323
{
2424
name : "grafana",
2525
image : data.aws_ecr_repository.repository.repository_url,
26-
container_name: "grafana",
26+
container_name : "grafana",
2727
essential : true,
2828
cpu : 512,
2929
memory : 512,

ops/ecs/modules/postgres/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ resource "aws_ecs_task_definition" "task" {
2323
{
2424
name : "postgres",
2525
image : data.aws_ecr_repository.repository.repository_url,
26-
container_name: "postgres",
27-
container_port: 5432,
26+
container_name : "postgres",
27+
container_port : 5432,
2828
essential : true,
2929
cpu : 512,
3030
memory : 1024,
3131
portMappings : [
3232
{
3333
containerPort : 5432,
34-
hostPort : 5432,
35-
protocol : "tcp"
34+
hostPort : 5432,
35+
protocol : "tcp"
3636
}
3737
],
3838
logConfiguration : {

0 commit comments

Comments
 (0)