Initial Oracle Deep Data Security lab kit
This commit is contained in:
17
scripts/bootstrap.ps1
Normal file
17
scripts/bootstrap.ps1
Normal file
@@ -0,0 +1,17 @@
|
||||
param()
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Write-Host "Checking local tools..."
|
||||
|
||||
$tools = @("git", "terraform")
|
||||
foreach ($tool in $tools) {
|
||||
$cmd = Get-Command $tool -ErrorAction SilentlyContinue
|
||||
if ($null -eq $cmd) {
|
||||
Write-Warning "$tool not found in PATH"
|
||||
} else {
|
||||
Write-Host "$tool found: $($cmd.Source)"
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Bootstrap check finished."
|
||||
21
scripts/reset-scenario.ps1
Normal file
21
scripts/reset-scenario.ps1
Normal file
@@ -0,0 +1,21 @@
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Scenario,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$ConnectString,
|
||||
|
||||
[string]$SqlClient = "sql"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$resetScript = Join-Path $repoRoot "scenarios/$Scenario/sql/99_reset.sql"
|
||||
|
||||
if (-not (Test-Path $resetScript)) {
|
||||
throw "Reset script not found: $resetScript"
|
||||
}
|
||||
|
||||
Write-Host "Resetting scenario $Scenario"
|
||||
& $SqlClient $ConnectString "@$resetScript"
|
||||
34
scripts/run-scenario.ps1
Normal file
34
scripts/run-scenario.ps1
Normal file
@@ -0,0 +1,34 @@
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Scenario,
|
||||
|
||||
[string]$ConnectString,
|
||||
|
||||
[string]$SqlClient = "sql"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$scenarioDir = Join-Path $repoRoot "scenarios/$Scenario"
|
||||
$sqlDir = Join-Path $scenarioDir "sql"
|
||||
|
||||
if (-not (Test-Path $sqlDir)) {
|
||||
throw "Scenario SQL directory not found: $sqlDir"
|
||||
}
|
||||
|
||||
$scripts = Get-ChildItem -Path $sqlDir -Filter "*.sql" | Where-Object { $_.Name -ne "99_reset.sql" } | Sort-Object Name
|
||||
|
||||
Write-Host "Scenario: $Scenario"
|
||||
Write-Host "Scripts to execute:"
|
||||
$scripts | ForEach-Object { Write-Host " - $($_.Name)" }
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($ConnectString)) {
|
||||
Write-Warning "ConnectString not provided. Review the SQL files above and execute them manually with SQLcl or SQL*Plus."
|
||||
exit 0
|
||||
}
|
||||
|
||||
foreach ($script in $scripts) {
|
||||
Write-Host "Running $($script.FullName)"
|
||||
& $SqlClient $ConnectString "@$($script.FullName)"
|
||||
}
|
||||
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