Skip to content

Commit f77dc22

Browse files
committed
Validate whether non-azurerm resources exist
1 parent 39304fe commit f77dc22

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

common/functions/terraform.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ function Erase-TerraformAzureResources {
133133
}
134134

135135
try {
136+
# Validate whether non-azurerm resources are present
137+
terraform state list | Select-String -Pattern '\.(azuredevops|azuread)_' | Set-Variable aadOrAzdoResources
138+
if ($aadOrAzdoResources) {
139+
Write-Warning "The following resources are present in the Terraform state, which are not supported by this function:"
140+
$aadOrAzdoResources
141+
return
142+
}
143+
136144

137145
if (!$Repository) {
138146
$Repository = Find-RepositoryDirectory

0 commit comments

Comments
 (0)