-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathEnvironmentTearDown.ps1
More file actions
27 lines (23 loc) · 863 Bytes
/
EnvironmentTearDown.ps1
File metadata and controls
27 lines (23 loc) · 863 Bytes
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
if ((Get-AWSCredentials) -eq $null)
{
throw "You must set credentials via Set-AWSCredentials before running this cmdlet."
}
if ((Get-DefaultAWSRegion) -eq $null)
{
throw "You must set a region via Set-DefaultAWSRegion before running this cmdlet."
}
function _deletePipelineBucket()
{
Get-S3Bucket | Where-Object {$_.BucketName.StartsWith("exploringaspnetcore-part2-")} | foreach {Write-Host 'Deleting pipeline bucket:' $_.BucketName; Remove-S3Bucket -BucketName $_.BucketName -DeleteBucketContent -Force}
}
function _deleteStack()
{
$stack = (Get-CFNStack -StackName "ExploringAspNetCore-Part2" | Where-Object {$_.StackName -eq "ExploringAspNetCore-Part2"})
if($stack -ne $null)
{
Write-Host "Deleting CloudFormation existing stack"
Remove-CFNStack $stack.StackName -Force
}
}
_deletePipelineBucket
_deleteStack