Initial Oracle Deep Data Security lab kit
This commit is contained in:
27
scripts/validate-terraform.ps1
Normal file
27
scripts/validate-terraform.ps1
Normal file
@@ -0,0 +1,27 @@
|
||||
param(
|
||||
[string]$Environment = "demo"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$tfDir = Join-Path $repoRoot "terraform/envs/$Environment"
|
||||
|
||||
if (-not (Test-Path $tfDir)) {
|
||||
throw "Terraform environment not found: $tfDir"
|
||||
}
|
||||
|
||||
$terraform = Get-Command terraform -ErrorAction SilentlyContinue
|
||||
if ($null -eq $terraform) {
|
||||
throw "Terraform is not installed or not in PATH. Install Terraform 1.6+ and rerun this script."
|
||||
}
|
||||
|
||||
Push-Location $tfDir
|
||||
try {
|
||||
terraform fmt -recursive -check
|
||||
terraform init -backend=false
|
||||
terraform validate
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
Reference in New Issue
Block a user