Skip to content

Commit dc0c71d

Browse files
Merge pull request #29 from maddevsio/feature/Add-github-actions-ci
Added github actions to check Terraform code
2 parents 43c5ed7 + 2fe5c46 commit dc0c71d

File tree

2 files changed

+67
-3
lines changed

2 files changed

+67
-3
lines changed

.github/workflows/terraform-ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: 'Terraform-ci'
2+
3+
on: [push, pull_request]
4+
5+
defaults:
6+
run:
7+
shell: sh
8+
9+
jobs:
10+
# Terraform validate configuration
11+
terraform-validate:
12+
name: 'Terraform-validate'
13+
runs-on: ubuntu-latest
14+
container:
15+
image: hashicorp/terraform:0.14.6
16+
env:
17+
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
- name: Terraform Init l1
22+
working-directory: ./terraform/layer1-aws
23+
run: terraform init -backend=false
24+
- name: Terraform Init l2
25+
working-directory: ./terraform/layer2-k8s
26+
run: terraform init -backend=false
27+
- name: Terraform Validate l1
28+
working-directory: ./terraform/layer1-aws
29+
run: terraform validate -no-color .
30+
- name: Terraform Validate l2
31+
working-directory: ./terraform/layer2-k8s
32+
run: terraform validate -no-color .
33+
34+
# Checks that all Terraform configuration files format
35+
terraform-format:
36+
name: 'Terraform-format'
37+
runs-on: ubuntu-latest
38+
container:
39+
image: hashicorp/terraform:0.14.6
40+
env:
41+
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v2
45+
- name: Terraform Format
46+
run: terraform fmt -recursive -write=false -check .
47+
48+
# Checks that all Terraform configuration files tflint
49+
terraform-tflint:
50+
name: 'Terraform-tflint'
51+
runs-on: ubuntu-latest
52+
container:
53+
image: wata727/tflint
54+
env:
55+
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@v2
59+
- name: Terraform tflint l1
60+
working-directory: ./terraform/layer1-aws
61+
run: tflint --no-color
62+
- name: Terraform tflint l2
63+
working-directory: ./terraform/layer2-k8s
64+
run: tflint --no-color

terraform/modules/aws-ec2-pritunl/efs.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ resource "aws_efs_file_system" "this" {
77
kms_key_id = var.kms_key_id
88

99
tags = {
10-
"Name" = var.name
11-
}
10+
"Name" = var.name
11+
}
1212
lifecycle {
1313
ignore_changes = [
1414
tags,
@@ -17,7 +17,7 @@ resource "aws_efs_file_system" "this" {
1717
}
1818

1919
resource "aws_efs_mount_target" "this" {
20-
count = length(var.public_subnets)
20+
count = length(var.public_subnets)
2121
file_system_id = aws_efs_file_system.this.id
2222
subnet_id = var.public_subnets[count.index]
2323
security_groups = [

0 commit comments

Comments
 (0)