1. Please change the values of the variables accordingly.
2. The entire YAML pipeline is build using Variables. No Values are Hardcoded.
PART #2:-
This is a Single Stage Pipeline - TEST_CDK_FOR_TERRAFORM_ON_WINDOWS (with 1 Pipeline Task):-
###################
# Declare Stages:-
###################
stages:
- stage: TEST_CDK_FOR_TERRAFORM_ON_WINDOWS
jobs:
- job: TEST_CDK_FOR_TERRAFORM_ON_WINDOWS
displayName: TEST CDK FOR TERRAFORM ON WINDOWS
steps:
PIPELINE TASK #1:-:-
1. Validate Chocolatey Package Manager.
2. Install and validate Terraform.
3. Validate Node.
4. Validate Yarn.
5. Install and validate CDK for Terraform.
##################################################
# Test CDK for Terraform in Windows Build Agent:-
##################################################
- task: AzureCLI@2
displayName: Test CDK for Terraform on Windows
inputs:
azureSubscription: $(ServiceConnection)
scriptType: ps
scriptLocation: inlineScript
inlineScript: |
echo "##########################################################"
$choco_ver = choco -v
echo "The latest chocolatey version installed is: $choco_ver"
echo "##########################################################"
echo "Terraform is NOT INSTALLED!."
echo " Proceed to installation..."
echo "##########################################################"
choco install terraform -y
$tf_validate_install = terraform -v
echo "##########################################################"
echo "The latest terraform version installed is: $tf_validate_install"
echo "##########################################################"
$node_ver = node --version
echo "The latest node version installed is: $node_ver"
echo "##########################################################"
$yarn_ver = yarn --version
echo "The latest yarn version installed is: $yarn_ver"
echo "##########################################################"
echo "CDK for Terraform is NOT INSTALLED!."
echo "Proceed to installation..."
npm install --global cdktf-cli@latest
npm install @cdktf/provider-azurerm
echo "##########################################################"
$cdktf_validate_install = cdktf --version
echo "The latest cdktf version installed is: $cdktf_validate_install"
echo "##########################################################"
NOW ITS TIME TO TEST!!!
TEST CASES:-
1. Pipeline executed successfully.
2. Terraform Installed and Validated Successfully.
3. Node and Yarn version validated Successfully.
4. CDK for Terraform Installed and Validated Successfully.
Hope You Enjoyed the Session!!!
Stay Safe | Keep Learning | Spread Knowledge
Top comments (0)
Subscribe
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)