Course contentsShow
← Cloud and Infrastructure
Lesson 699 of 2,98913. Infrastructure as Code FoundationsFree lesson

Apply and Provisioning

Understand the apply phase where IaC tools create, update, or delete resources to match desired state.

Apply and Provisioning

What you'll learn: How IaC tools actually create, update, or delete your infrastructure resources to match what you defined in code.

Understanding Apply

After you've written your configuration files and reviewed the plan preview (the dry-run showing what changes will happen), the apply phase is where the magic happens. This is when your Infrastructure as Code tool takes action and talks to cloud providers' APIs to make your desired infrastructure state a reality.

Think of it like a construction crew following blueprints. The planning phase showed you what they'll build—the apply phase is when they actually pour concrete, raise walls, and install systems.

What Happens During Apply

When you execute an apply command, your IaC tool:

  1. Reads the desired state from your configuration files
  2. Compares it to the current state of existing resources
  3. Executes API calls to create new resources, modify existing ones, or delete obsolete infrastructure
  4. Tracks progress and handles dependencies (creating networks before servers, for example)
  5. Updates the state file to reflect the new reality

Provisioning in Action

Provisioning is the actual process of allocating and configuring resources. During apply, your tool might provision a virtual machine, set up networking rules, create storage buckets, or configure databases—all in the correct order based on dependencies.

The tool handles complex orchestration automatically: it won't try to attach a disk to a server that doesn't exist yet, or delete a network that still has active resources connected to it.

After Apply Completes

You'll see a summary showing what was created, changed, or destroyed. The infrastructure now matches your code, and your state tracking is updated.

Key Takeaway: The apply phase transforms your infrastructure code into real cloud resources by executing planned changes through provider APIs, handling dependencies automatically, and updating state to reflect the new infrastructure reality.