You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/ALZ/Private/Deploy-Accelerator-Helpers/Invoke-Terraform.ps1
+12-3Lines changed: 12 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -19,11 +19,20 @@ function Invoke-Terraform {
19
19
[Parameter(Mandatory=$false)]
20
20
[string] $outputFilePath="",
21
21
22
-
[Parameter(Mandatory=$false)]
23
-
[switch] $silent
22
+
[Parameter(Mandatory=$false)]
23
+
[switch] $silent,
24
+
25
+
[Parameter(Mandatory=$false)]
26
+
[switch] $generateOnly
24
27
)
25
28
26
-
if ($PSCmdlet.ShouldProcess("Apply Terraform","modify")) {
29
+
if ($PSCmdlet.ShouldProcess("Apply Terraform","modify")) {
30
+
31
+
if ($generateOnly) {
32
+
Write-InformationColored"Generate only mode enabled. Terraform files have been generated but terraform init, plan, and apply have been skipped."-ForegroundColor Green -NewLineBefore -InformationAction Continue
33
+
return
34
+
}
35
+
27
36
# Check and Set Subscription ID
28
37
$removeSubscriptionId=$false
29
38
if ($null-eq$env:ARM_SUBSCRIPTION_ID-or$env:ARM_SUBSCRIPTION_ID-eq"") {
Write-InformationColored"Thank you for providing those inputs, we are now initializing and applying Terraform to bootstrap your environment..."-ForegroundColor Green -NewLineBefore -InformationAction Continue
Write-InformationColored"Once the plan is complete you will be prompted to confirm the apply."-ForegroundColor Green -NewLineBefore -InformationAction Continue
Write-InformationColored"Thank you for providing those inputs, we are now generating the Terraform files for your environment..."-ForegroundColor Green -NewLineBefore -InformationAction Continue
279
+
} else {
280
+
Write-InformationColored"Thank you for providing those inputs, we are now initializing and applying Terraform to bootstrap your environment..."-ForegroundColor Green -NewLineBefore -InformationAction Continue
Write-InformationColored"Once the plan is complete you will be prompted to confirm the apply."-ForegroundColor Green -NewLineBefore -InformationAction Continue
Write-InformationColored"Terraform files have been generated successfully! You can now use them with your custom pipeline or terraform state configuration."-ForegroundColor Green -NewLineBefore -InformationAction Continue
294
+
} else {
295
+
Write-InformationColored"Bootstrap has completed successfully! Thanks for using our tool. Head over to Phase 3 in the documentation to continue..."-ForegroundColor Green -NewLineBefore -InformationAction Continue
280
296
}
281
-
282
-
Write-InformationColored"Bootstrap has completed successfully! Thanks for using our tool. Head over to Phase 3 in the documentation to continue..."-ForegroundColor Green -NewLineBefore -InformationAction Continue
HelpMessage="[OPTIONAL] Only generate Terraform files without running terraform init, plan, or apply. This is useful for custom tfstate configurations or other pipelines. Environment variable: ALZ_generate_only. Config file input: generate_only."
0 commit comments