Setup Gitflow and Run Terraform in an Azure DevOps Pipeline
Вставка
- Опубліковано 5 лют 2025
- EPISODE 8
Setup an End-to-End Azure DevOps Pipeline and Gitflow process.
Keep the knowledge flowing!
www.buymeacoff...
Source Code:
github.com/mar...
AzDO Bash@3 Task:
learn.microsof...
Azure ARM Resources Provider
registry.terra...
v3.41.0
registry.terra...
Additional Providers:
Random Provider (registry.terra...)
Terraform Resource List:
random_string
azurerm_resource_group
Azure Resource Naming Conventions
learn.microsof...
Great content and it would be more practical if we have workspace variables and not just the environment. the PR workflow is awesome :) also wondering how we can pass variables to the ADO pipeline from a third-party like Service Now?
What do you mean by workspace variables? I'll have to look into integration with 3p tools! Good idea!
@@azure-terraformer I mean lets have option to create or select workspace over pipeline workflow so anytime we reuse the pipeline we will have a new workspace or if we want can just select and modify existing one.
Example: #!/bin/bash
echo "*********** Create or select workspace"
if [ $(terraform workspace list | grep -c "$1") -eq 0 ] ; then
echo "Create new workspace $1"
terraform workspace new "$1" -no-color
else
echo "Switch to workspace $1"
terraform workspace select "$1" -no-color
fi
I used that Bash script on my Yml pipeline multi stage just testing however like to see how we can use it on a more complex scenario workflow, thanks
Ah, I see what you mean. There are different schools of thought. While you CAN use the same pipeline to deploy every environment, I prefer having different pipelines (same YAML, different AzDO pipeline) to exercise some command+control around the application / environment you are deploying. It also creates a clean deployment history for that environment in the pipeline run history. Just my opinion, but my recommendation is to be careful about having too much reuse / centralization.
> "too much reuse / centralization"
When DRY goes wrong it is so painful to work with 😵
What is the purpose of validate in release pipeline?
Just an inexpensive check in case Terraform code has gotten nasty somehow. It fails faster then a plan if there are some bad references somewhere.
@@azure-terraformer yes, but it runs only after PR was already checked