forked from dod-iac/terraform-aws-ecs-task-execution-role
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.bat
88 lines (65 loc) · 1.6 KB
/
make.bat
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
@echo off
rem # =================================================================
rem #
rem # Work of the U.S. Department of Defense, Defense Digital Service.
rem # Released as open source under the MIT License. See LICENSE file.
rem #
rem # =================================================================
rem isolate changes to local environment
setlocal
rem create local bin folder if it doesn't exist
if not exist "%~dp0bin" (
mkdir %~dp0bin
)
rem update PATH to include local bin folder
PATH=%~dp0bin;%PATH%
rem set common variables for targets
set "USAGE=Usage: %~n0 [clean|format_terraform|update_docs|help]"
rem if no target, then print usage and exit
if [%1]==[] (
echo|set /p="%USAGE%"
exit /B 1
)
REM remove bin directory
if %1%==clean (
if exist %~dp0bin (
rd /s /q %~dp0bin
)
exit /B 0
)
if %1%==format_terraform (
where terraform >nul 2>&1 || (
echo|set /p="terraform is missing."
exit /B 1
)
terraform fmt
for /R "%~dp0examples" %%e in (.) do (
if exist %%e\main.tf (
pushd %%e
terraform fmt
popd
)
)
exit /B 0
)
if %1%==update_docs (
where terraform-docs >nul 2>&1 || (
echo|set /p="terraform-docs is missing/"
exit /B 1
)
powershell "%~dp0scripts\update-readme-windows.ps1"
for /R "%~dp0examples" %%e in (.) do (
if exist %%e\main.tf (
pushd %%e
powershell "%~dp0scripts\update-readme-windows.ps1"
popd
)
)
exit /B 0
)
if %1%==help (
echo|set /p="%USAGE%"
exit /B 1
)
echo|set /p="%USAGE%"
exit /B 1