Skip to content

Commit

Permalink
Add rudimentary Powershell build script (Azure#1) (Azure#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdhunt authored Oct 1, 2020
1 parent c8d9a3e commit c9dfef6
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions make.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

[CmdletBinding()]
param (
[ValidateSet('install', 'generate', 'format', 'validate', 'build', 'all')]
[string]$Task = 'all'
)

function install {
$env:GO111MODULE = "on"
if (-not (Get-Command "terraform" -CommandType Application -ea 0)) { & go get github.com/hashicorp/terraform@v0.12.26 }
if (-not (Get-Command "terraform-docs" -CommandType Application -ea 0)) { & go get github.com/segmentio/terraform-docs@v0.9.1 }
if (-not (Get-Command "tfsec" -CommandType Application -ea 0)) { & go get github.com/liamg/tfsec/cmd/tfsec@v0.21.0 }
if (-not (Get-Command "tflint" -CommandType Application -ea 0)) { & go get github.com/terraform-linters/tflint@v0.16.2 }
}

function generate {
& go run main.go
}

function format {
& terraform fmt
}

function validate {
& terraform fmt --check
& terraform validate -no-color
& tflint --no-color
}

function build {
install
generate
}

function all {
build
format
validate
}

Invoke-Expression $Task

0 comments on commit c9dfef6

Please sign in to comment.