From b0fc01efc6073ea06610197376bfe5357de722f0 Mon Sep 17 00:00:00 2001 From: Vasilii Polikarpov <126792224+vpolikarpov-akvelon@users.noreply.github.com> Date: Wed, 6 Dec 2023 13:56:10 +0100 Subject: [PATCH] Add deprecation warning to GenerateResourcesAndImage helper (#8958) --- helpers/GenerateResourcesAndImage.ps1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/helpers/GenerateResourcesAndImage.ps1 b/helpers/GenerateResourcesAndImage.ps1 index 70cc58a37..b8bab020f 100644 --- a/helpers/GenerateResourcesAndImage.ps1 +++ b/helpers/GenerateResourcesAndImage.ps1 @@ -97,8 +97,10 @@ Function GenerateResourcesAndImage { This parameter cannot be used in combination with the virtual_network_name packer parameter. .PARAMETER Force Delete the resource group if it exists without user confirmation. + This parameter is deprecated and will be removed in a future release. .PARAMETER ReuseResourceGroup Reuse the resource group if it exists without user confirmation. + This parameter is deprecated and will be removed in a future release. .PARAMETER OnError Specify how packer handles an error during image creation. Options: @@ -146,6 +148,10 @@ Function GenerateResourcesAndImage { [hashtable] $Tags = @{} ) + if ($Force -or $ReuseResourceGroup) { + Write-Warning "The `ReuseResourceGroup` and `Force` parameters are deprecated and will be removed in a future release. The resource group will be reused when it already exists and an error will be thrown when it doesn't. If you want to delete the resource group, please delete it manually." + } + if ($Force -and $ReuseResourceGroup) { throw "Force and ReuseResourceGroup cannot be used together." }