feat: ensure non-interactive mode is set for Terraform commands #303
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request updates the Terraform task handlers in both version 4 and version 5 to ensure the
-input=false
flag is consistently added to all Terraform commands (init
,plan
,apply
, anddestroy
) if it is not already present in thecommandOptions
. This change improves automation by disabling interactive prompts during Terraform execution.Updates to Terraform Task Handlers
Changes in Version 4 (
TerraformTaskV4
):init
Command: Added logic to append-input=false
tocommandOptions
if not already present. ([Tasks/TerraformTask/TerraformTaskV4/src/base-terraform-command-handler.tsR77-R84](https://github.com/microsoft/azure-pipelines-terraform/pull/303/files#diff-f68cda4f8181153bf1003884dfec243ab7aedf1a5d0ee95edc94a3952ea06b37R77-R84)
)plan
Command: Ensured-input=false
is appended tocommandOptions
alongside-detailed-exitcode
. ([Tasks/TerraformTask/TerraformTaskV4/src/base-terraform-command-handler.tsL156-R163](https://github.com/microsoft/azure-pipelines-terraform/pull/303/files#diff-f68cda4f8181153bf1003884dfec243ab7aedf1a5d0ee95edc94a3952ea06b37L156-R163)
)apply
Command: Appended-input=false
toadditionalArgs
if missing, ensuring non-interactive execution. ([Tasks/TerraformTask/TerraformTaskV4/src/base-terraform-command-handler.tsL214-R226](https://github.com/microsoft/azure-pipelines-terraform/pull/303/files#diff-f68cda4f8181153bf1003884dfec243ab7aedf1a5d0ee95edc94a3952ea06b37L214-R226)
)destroy
Command: Added-input=false
toadditionalArgs
if not already included. ([Tasks/TerraformTask/TerraformTaskV4/src/base-terraform-command-handler.tsL236-R252](https://github.com/microsoft/azure-pipelines-terraform/pull/303/files#diff-f68cda4f8181153bf1003884dfec243ab7aedf1a5d0ee95edc94a3952ea06b37L236-R252)
)Changes in Version 5 (
TerraformTaskV5
):init
Command: Same logic as in version 4 to add-input=false
tocommandOptions
. ([Tasks/TerraformTask/TerraformTaskV5/src/base-terraform-command-handler.tsR77-R84](https://github.com/microsoft/azure-pipelines-terraform/pull/303/files#diff-1a3717e44dc2d4fb00c77cba4c316848cd4c64b0f043e079b120a96ec8c24839R77-R84)
)plan
Command: Ensured-input=false
is appended tocommandOptions
alongside-detailed-exitcode
. ([Tasks/TerraformTask/TerraformTaskV5/src/base-terraform-command-handler.tsL156-R163](https://github.com/microsoft/azure-pipelines-terraform/pull/303/files#diff-1a3717e44dc2d4fb00c77cba4c316848cd4c64b0f043e079b120a96ec8c24839L156-R163)
)apply
Command: Appended-input=false
toadditionalArgs
if missing, similar to version 4. ([Tasks/TerraformTask/TerraformTaskV5/src/base-terraform-command-handler.tsL214-R226](https://github.com/microsoft/azure-pipelines-terraform/pull/303/files#diff-1a3717e44dc2d4fb00c77cba4c316848cd4c64b0f043e079b120a96ec8c24839L214-R226)
)destroy
Command: Added-input=false
toadditionalArgs
if not already included. ([Tasks/TerraformTask/TerraformTaskV5/src/base-terraform-command-handler.tsL236-R252](https://github.com/microsoft/azure-pipelines-terraform/pull/303/files#diff-1a3717e44dc2d4fb00c77cba4c316848cd4c64b0f043e079b120a96ec8c24839L236-R252)
)