CLOUD SECURITY / INFRASTRUCTURE AS CODE
AZURE TERRAFORM BUILD · OCTOBER 2025

MINI ENTERPRISE INFRASTRUCTURE / AZURE + TERRAFORM

Build the foundation.
Define it in code.

Network. Storage.
A repeatable starting point.

I built this Azure lab to put infrastructure decisions into Terraform: address space, subnet rules, storage configuration and lifecycle management, before adding workloads.

Infrastructure as code · Demonstration environment · No compute resources

Mini Enterprise Infrastructure on Azure using Terraform, with networked server towers, code panels, and the Azure and Terraform logos.

01 / START BEFORE THE WORKLOAD

A small deployment.
Explicit decisions.

Infrastructure as code (IaC) makes the intended configuration reviewable, version-controlled and repeatable.

This project defines a compact Azure foundation: a resource group, virtual network, subnet, network security group and blob storage. It leaves compute out so the focus stays on the infrastructure beneath an application.

The result is a lab for exploring network boundaries, storage settings and change management. Logging, security monitoring and application workloads can be added as separate extensions.

10.10.0.0/16
Virtual network address space
10.10.1.0/24
Subnet reserved for future workloads
TLS 1.2
Configured minimum for storage connections
30 days
Base-blob lifecycle deletion threshold

02 / ARCHITECTURE AT A GLANCE

Two layers.
Different boundaries.

The network establishes address space and subnet traffic rules. Storage provides an authenticated destination for logs or artifacts.

An Azure Network Security Group (NSG) filters traffic for the associated subnet. Blob container permissions control anonymous access to data. These are distinct controls, and the storage account is a separate Azure service.

LOGICAL RESOURCE MAP / TERRAFORM LAB
Terraform configurationProvisions resources through Azure Resource Manager

AZURE RESOURCE GROUP / LOGICAL ORGANIZATION

NETWORK FOUNDATION

Virtual network

10.10.0.0/16

app-subnet

10.10.1.0/24

Reserved for future workloads.
No virtual machines are deployed.

NSG → associated with app-subnet

Sample inbound TCP rules: 22 and 80.
Azure default NSG rules also apply.

STORAGE FOUNDATION

Standard storage account

Locally redundant storage (LRS)
Minimum TLS 1.2
Blob versioning enabled

logs / blob container

Private access level: no anonymous reads.

Lifecycle policy

Targets block blobs under logs/ after more than 30 days since modification.

Storage is not placed inside the subnet. This baseline does not configure a storage private endpoint or a private network connection between these layers.

Network foundation

The VNet and subnet define private IP ranges. The NSG is associated with the subnet, ready for later workloads. The lab does not provision virtual machines or public IP resources.

Storage foundation

The storage account and logs container establish a destination for future artifacts or telemetry. Private container access requires authorization; it does not disable the account’s public network endpoint.

TECHNICAL WALKTHROUGH

FROM TERRAFORM TO AZURE

Follow the build.

See the infrastructure definition and the deployment workflow in the project demonstration.

The walkthrough accompanies the repository, making the network and storage decisions easier to follow.

YouTube player · No autoplay

Watch the technical walkthrough on YouTube

03 / DESIGN DECISIONS

Know what each
control does.

I kept the lab compact so the configuration is easy to trace and the next design decisions are clear.

It demonstrates infrastructure patterns that can support a larger environment. Production isolation, identity and operational controls need to be designed around the workload.

Subnet filtering
The NSG permits inbound TCP 22 for SSH and TCP 80 for HTTP from any source as demonstration rules.
Before adding workloads, restrict sources and ports to actual access requirements. These rules are not a least-privilege production baseline.
Authenticated storage
The logs container uses private access. The account enables shared-key access and sets a minimum TLS version of 1.2.
Network isolation requires separate configuration. A private endpoint, DNS and public-network restrictions are potential additions.
Versioning & lifecycle
Blob versioning is enabled. A policy targets current block blobs in logs/ once their last-modified age exceeds 30 days.
Previous versions need their own lifecycle rules. Deletion is asynchronous, so this is not an exact 30-day retention guarantee.
Lean resource scope
No virtual machines or other compute workloads are provisioned.
Storage capacity, operations and retained versions can incur charges. Free allowances depend on account eligibility and usage.
Why “private container” and “private endpoint” are different

A private blob container prevents anonymous data access. An authenticated client can still use the storage service’s public endpoint when network access permits it.

A private endpoint provides a private IP connection to the service. To restrict storage access to that path, configure the endpoint, name resolution and appropriate public-network access settings. The subnet NSG does not automatically protect a separate storage account.

Microsoft documentation: private endpoints for Azure Storage

Lifecycle policy, versioning and log retention

The demo policy applies to base block blobs with the logs/ prefix and a last-modified age greater than 30 days. It does not configure deletion of previous versions or snapshots.

When versioning is enabled, current-blob deletion has additional lifecycle conditions involving previous versions. A complete retention design should address versions, snapshots, soft delete and any legal or operational retention requirements together.

Microsoft documentation: lifecycle conditions and actions

Cost and expansion

Leaving out compute keeps the resource scope small, but it does not guarantee a zero bill. Storage consumption, transactions, versions and any later services must be included in the estimate.

Microsoft Sentinel, Defender for Cloud, Log Analytics, private endpoints and future workloads each require their own configuration and cost review. They are extension options, not deployed capabilities in this baseline.

Azure Blob Storage pricing

04 / THE IMPLEMENTATION

A readable blueprint.
A reviewable change.

The core definition lives in main.tf, including provider requirements, input variables, resources and outputs.

Version control records intended changes. Terraform plans help compare that intent with the environment. Out-of-band changes can still introduce drift, so review and reconciliation remain part of the workflow.

  1. 01DefineDescribe resources, inputs and dependencies in Terraform.
  2. 02ReviewValidate configuration and examine the plan before applying changes.
  3. 03ApplyProvision the approved resource changes in the intended subscription.
  4. 04VerifyCheck resulting settings, access paths and costs; remove lab resources when finished.

Suggested review workflow. Infrastructure code supports consistency; it does not eliminate configuration mistakes or drift by itself.

Tools behind the build

  • Terraform 1.5 or later.
  • AzureRM provider 4.0 or later.
  • Random provider 3.5 or later for the storage-name suffix.
  • Azure CLI for the authentication context.
  • Visual Studio Code for editing and validation.

A foundation for extension

The network and storage resources can support future logging, automation or application experiments. I would extend the design with workload-specific access rules, identity-based storage access, private connectivity and monitoring as those requirements develop.

SIEM integration, compute and remote-state management are separate next steps. A subnet and NSG alone do not constitute a complete Zero Trust architecture.

Repository structure and configuration
main.tf
Provider constraints, variables, resources and deployment outputs.
terraform.tfvars.example
Example input values for adapting the lab.
scripts/
Helpers for initialization, apply and teardown.
README.md
Project overview and setup instructions.

The provider configuration includes subscription and tenant placeholders. Configure the intended Azure context before deployment, protect Terraform state, and review helper scripts before running them. The declared provider ranges are broad; use a reviewed lock file for repeatable dependency selection.

What this lab demonstrates

A code-defined Azure network and storage foundation, explicit subnet association, configurable resource naming, transport settings and lifecycle policy. It is an educational deployment pattern, not a claim of enterprise certification or tested production isolation.

Before extending it, validate identity permissions, network reachability, actual retention behavior and monitoring against the intended workload.

HashiCorp documentation: managing resource drift · Microsoft documentation: NSG rules and defaults

SECURITY STARTS IN THE BLUEPRINT

Define the boundaries.
Then build on them.

Explore the Terraform configuration and follow the walkthrough to see how the foundation comes together.

BUILT & WRITTEN BY

Jibril Anifowoshe, M.S., CISM

Enterprise Cybersecurity Leader & AI Security Strategist

Cloud Security · Zero Trust Design · Advanced Threat Modeling
Incident Response Leadership · Infrastructure as Code

Connect on LinkedInBack to top

October 2025