Skip to content

Commit

Permalink
Lint Terraform (#58)
Browse files Browse the repository at this point in the history
* Lint

* unlint

* Fix

* Fix again

* Lint

* Lint again
  • Loading branch information
ArmaanT authored Mar 13, 2021
1 parent d4fc465 commit 82f28e6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 25 deletions.
27 changes: 15 additions & 12 deletions .github/cdk/main.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
import { App, Job, Stack, Workflow } from "cdkactions";
import { App, CheckoutJob, Stack, Workflow } from "cdkactions";
import { CDKPublishStack } from "@pennlabs/kraken"
import { Construct } from "constructs";

export class AutoApproveStack extends Stack {
class TerraformLintStack extends Stack {
constructor(scope: Construct, name: string) {
super(scope, name);

const workflow = new Workflow(this, 'approve', {
name: 'Auto Approve dependabot PRs',
on: 'pullRequest',
const workflow = new Workflow(this, 'terraform', {
name: 'Lint terraform files',
on: {
push: {
paths: ['terraform/**.tf']
}
},
});

new Job(workflow, 'approve', {
new CheckoutJob(workflow, 'lint', {
runsOn: 'ubuntu-latest',
steps: [
{
uses: 'hmarr/auto-approve-action@v2.0.0',
if: "github.actor == 'dependabot[bot]'",
with: {
"github-token": "${{ secrets.BOT_GITHUB_PAT }}"
}
uses: 'hashicorp/setup-terraform@v1'
},
{
run: 'terraform fmt -check -recursive terraform'
}
],
});
Expand All @@ -29,5 +32,5 @@ export class AutoApproveStack extends Stack {
const app = new App();
new CDKPublishStack(app, 'kraken');
new CDKPublishStack(app, 'kittyhawk');
new AutoApproveStack(app, 'approve');
new TerraformLintStack(app, 'terraform');
app.synth();
12 changes: 0 additions & 12 deletions .github/workflows/cdkactions_approve.yaml

This file was deleted.

14 changes: 14 additions & 0 deletions .github/workflows/cdkactions_terraform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generated by cdkactions. Do not modify
# Generated as part of the 'terraform' stack.
name: Lint terraform files
on:
push:
paths:
- terraform/**.tf
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: hashicorp/setup-terraform@v1
- run: terraform fmt -check -recursive terraform
2 changes: 1 addition & 1 deletion terraform/modules/vault_flush/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ variable "path" {

variable "entry" {
description = "Entries to replace within the secret"
type = map
type = map(any)
}

0 comments on commit 82f28e6

Please sign in to comment.