How to address IaC shortcomings – Part 3?
A previous article
discussed a resolution to IaC shortcomings for declaring resources with
configuration not yet supported by an IaC repository. This article discusses
another case where the IaC does not fully address all concerns for packaging a
solution specifically blueprints.
As a recap, Azure Blueprints can be leveraged to allow an
engineer or architect to sketch a project’s design parameters, define a
repeatable set of resources that implements and adheres to an organization’s
standards, patterns and requirements. It
is a declarative way to orchestrate the deployment of various resource
templates and other artifacts such as role assignments, policy assignments, ARM
templates, and Resource Groups. Blueprint Objects are stored in the CosmosDB
and replicated to multiple Azure regions. Since it is designed to setup the
environment, it is different from resource provisioning. This package fits
nicely into a CI/CD.
With Azure templates, one or more Azure resources can be
described with a document, but it doesn’t exist natively in Azure and must be
stored locally or in source control. Once those resources deploy, there is no
active connection or relationship to the template.
Other IaC providers like Terraform also have features such
that it tracks the state of the real-world resources which makes Day-2 and
onward operations easier and more powerful and with Azure Blueprints, the
relationship between what should be deployed and what was deployed is
preserved. This connection supports improved tracking and auditing of
deployments. It even works across several subscriptions with the same
blueprint.
Typically, the choice is not between a blueprint and a
resource template because one comprises the other but between an Azure
Blueprint and a Terraform tfstate. They differ in their organization
methodology as top-down or bottom-up. Blueprints are great candidates for
compliance and regulations while Terraform is preferred by developers for their
flexibility. Blueprints manage Azure resources only while Terraform can work
with various resource providers.
Once the choice is made, some challenges will require to be
tackled next. The account with which the IaC is deployed and the secrets it
must know for those deployments to occur correctly are something that works
centrally and not in the hands of individual end-users. Packaging and
distributing solutions for end-users is easier when these can be read from a
single source of truth in the cloud, so at least the location in the cloud for
the solution to read and deploy the infrastructure must be known beforehand.
The organization can make use of the best of both worlds
with a folder structure that separates the Terraform templates into a folder
called ‘module’ and the ARM Templates in another folder at the same level and
named something like ‘subscription-deployments’ and includes native blueprints
and templates. The GitHub workflow definitions will leverage proper handling of
either location or trigger the workflow on any changes to either of these
locations.
Finally, PowerShell scripts can help with both the
deployment as well as the pipeline automations. There are a few caveats with
scripts because the general preference is for declarative and idempotent IaC
rather than script whether those attributes are harder to enforce, and the
logic quickly expands to cover a lot more than originally anticipated. All
scripts can be stored in folders with names ending with ‘scripts’.
These are sufficient to address the above-mentioned shortcomings in the
Infrastructure-as-Code.
No comments:
Post a Comment