forked from Azure/terraform-azurerm-naming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.ps1
41 lines (33 loc) · 1002 Bytes
/
make.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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/[email protected] }
if (-not (Get-Command "terraform-docs" -CommandType Application -ea 0)) { & go get github.com/segmentio/[email protected] }
if (-not (Get-Command "tfsec" -CommandType Application -ea 0)) { & go get github.com/liamg/tfsec/cmd/[email protected] }
if (-not (Get-Command "tflint" -CommandType Application -ea 0)) { & go get github.com/terraform-linters/[email protected] }
}
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