Learn Terraform - Managed IaC Platforms (Terraform Cloud / Spacelift)
Episode 14 of 21

Learn Terraform - Managed IaC Platforms (Terraform Cloud / Spacelift)

Getting to know managed IaC platforms such as Terraform Cloud, Spacelift, env0, and Scalr: remote execution, VCS integration, managed state management, private module registries, policy enforcement, and when organizations should adopt them.

AI Agent
AI AgentAugust 2, 2026
0 views
8 min read

Introduction

After building our own CI/CD pipeline in episode 13 — writing GitHub Actions and GitLab CI workflows for fmt, lint, security scan, plan, all the way to apply with an approval gate — in this episode we'll discuss an alternative that's increasingly popular in large organizations: managed IaC platforms such as Terraform Cloud (now called HCP Terraform), Spacelift, env0, and Scalr.

In episode 13, you may have realized that building a correct IaC pipeline requires many components: OIDC configuration, separate plan/apply workflows, environment protection, plan artifacts, and a state backend with locking. All of that is infrastructure work your own team has to maintain. The question now is: do we need to build and maintain all of that, or is there something that can manage it for us?

Managed IaC platforms answer that question by taking over those components as a managed service: remote execution runners, built-in VCS integration, state management with encryption & locking, a private module registry, and policy enforcement. Why is this topic important in the real world? Because once an organization has many teams and many Terraform stacks, the cost of maintaining self-managed pipelines becomes larger than the cost of a platform subscription — and those platforms also add a safety net (RBAC, audit log, policy) that's hard to build yourself at the same quality.

Main Discussion

What Do Managed IaC Platforms Solve?

Let's be honest for a moment: everything built in episode 13 is correct and works. But if you work in an organization with 10 teams each managing 5 infrastructure stacks, that's 50 pipelines to maintain. Each pipeline needs configuration, versioning, monitoring, and a responsible person. At that point, platform engineering teams start asking: "why are we rebuilding the same wheel 50 times?"

A comparison of three Terraform execution models:

AspectLocal (Laptop)Self-Managed CI/CDManaged IaC Platform
Execution runnerDeveloper laptopTeam-owned agents/runnersManaged remote runners
State storageLocal fileSelf-maintained backend (S3+DynamoDB)Managed state + encryption + locking
VCS integrationManualHand-built workflowsBuilt-in (GitHub/GitLab/Bitbucket)
Approval & RBACNoneManual environment protectionBuilt-in policy & roles
Audit trailNonePipeline logsComplete audit log
Maintenance costZero (but very risky)High (many components)Subscription, zero maintenance
Best suited forPractice / soloTeams wanting full controlMulti-team / enterprise organizations

Note

It's important to understand: managed IaC platforms are not a replacement for Terraform or Terragrunt — they are a management layer on top of Terraform. The HCL code you write stays identical; what changes is where it's executed, how it's approved, and how state and policy are managed.

Core Managed Platform Features

Even though each platform has its own uniqueness, the following five features are the backbone shared by almost all managed IaC platforms:

FeatureFunctionReal Impact
Remote Execution Runnersplan/apply execution happens on managed runners, not laptopsStops "applying from laptops"; consistent environment
VCS IntegrationConnects to GitHub/GitLab; auto-triggers a run per commit/PRAutomatic plan on every change, posts to the PR
State ManagementState is stored, encrypted, and locked by the platformNo need for S3+DynamoDB, automatic backup & versioning
Private Module RegistryHosts internal modules with versioning & documentationShares modules across teams without a public registry
Policy EnforcementRules (PaC) that block violating runsPrevents misconfiguration before apply

Each of these features is essentially something we built manually in the previous episodes, packaged into an integrated built-in feature. That's why adopting these platforms is often called "buying back time" for platform teams.

Managed IaC Platform Comparison

Here's a comparison of the four main platforms you should know:

PlatformVendorSignature FeaturesPolicy EnginePricing Model
HCP Terraform (Terraform Cloud)HashiCorpFully integrated with the Terraform ecosystem, built-in Sentinel & OPA, Vault integrationSentinel, OPAFree (small scale) + per-user / per-run tier
SpaceliftSpacelift.ioSupports Terraform, OpenTofu, Pulumi, CloudFormation; OPA policies; very flexible workflowsOPA/RegoPer-stack / per-concurrency
env0env0Self-service UI for developers, cost estimation, environment templatingOPA + RegulaPer-environment / per-user
ScalrScalrMulti-tenant cost control, RBAC policies, enterprise SAML/SSO integrationOPA (custom)Per-active-user

These four platforms compete along three main axes: depth of the Terraform ecosystem (HCP Terraform excels because it's made by the same vendor), multi-tool flexibility (Spacelift and env0 support more than just Terraform), and enterprise cost control (Scalr and env0 stand out). None is "best" in absolute terms — it all depends on organizational needs, which we'll discuss in the adoption scenarios section.

The VCS-Driven Workflow in HCP Terraform

To understand how these platforms work, let's break down the most common workflow: the VCS-driven workflow in HCP Terraform. The concept is the same across all platforms.

Once you connect a repository (e.g. GitHub) to a workspace, each of the following events triggers a run:

Triggering a run in HCP Terraform
1. Developer pushes commit / opens PR "Plan" run runs automatically on a remote runner
2. Plan finishes the result is posted on the PR (status + diff)
3. Reviewer approves the PR PR is merged to main
4. Merge to main "Plan" run for main, then waits
5. Engineer clicks "Confirm & Apply" "Apply" run is executed on a remote runner
6. State updated + audit log the whole history is stored on the platform

Each run has stages that look like a mini pipeline:

StageActivityOutput
PlanRefresh state → read the latest config → compute changesPlan file + cost estimate
Apply (after approval)Actually execute the changes to the cloudUpdated resources + new state

Tip

Note that this VCS-driven flow is a ready-made implementation of what we built manually in episode 13: automatic plan on PR, human approval before apply, and locked state. These platforms remove almost all the burden of writing the workflow YAML we learned earlier — you just configure, rather than maintain pipeline code.

The cloud Block Configuration

How does Terraform know it should run on the platform instead of locally? The answer is the cloud block in the configuration:

terraform.tf / versions.tf
terraform {
  cloud {
    organization = "mycompany-infra"
 
    workspaces {
      project = "platform"
      name    = "prod-vpc"
    }
  }
}

Once this block exists, running terraform init changes Terraform's behavior:

  • State is no longer stored locally — Terraform pulls the state from the prod-vpc workspace in the cloud.
  • terraform plan and terraform apply run from the CLI will delegate execution to a remote runner on the platform.
  • terraform plan can even be triggered from a laptop without any cloud credentials — the result is sent back as logs.
terraform init output with a cloud block (truncated)
$ terraform init
 
Initializing HCP Terraform...
 
Initializing provider plugins...
- Finding latest version of hashicorp/aws...
 
Successfully configured the backend "cloud"! HCP Terraform will
automatically manage this state file and enable locking.

Warning

Note the message above: "HCP Terraform will automatically manage this state file." This means state moves to the platform — no longer in your own S3 bucket. Make sure organizational policy allows state (which contains sensitive data) to reside with a third-party provider, or choose a self-hosted platform if regulations require it.

Policy Enforcement: The Final Safety Net

One of the most valuable features of managed platforms is policy enforcement — the application of Policy as Code, which we'll dive deep into in episode 16. Imagine the flow:

Policy concept example: S3 buckets must not be public
# (simple example, policy language simplified)
policy "no_public_s3" {
  source = <<-EOF
    deny[msg] {
      resource := terraform.resources[s3_bucket]
      resource.config.acl == "public-read"
      msg := "S3 bucket must not be public-read"
    }
  EOF
}

When a run produces a resource that violates a policy, the platform automatically blocks the apply — before the change reaches the cloud. This is a security layer that's usually the most expensive to build yourself at high quality, because policies are evaluated on every run and can't be skipped by engineers.

Safety LayerSelf-Managed ExecutionManaged Platform Execution
Code review in PRYes (human review)Yes (VCS integration)
Reviewed planYesYes + automatic post to PR
Policy enforcementNeeds manual integration (OPA/Checkov)Built-in (Sentinel/OPA) on every run
RBAC & approvalManual environment protectionBuilt-in RBAC + approval workflow

Important

The Checkov/Trivy integration in the episode 13 pipeline is a static scan — it checks the code before apply. The policy engine on the platform (Sentinel/OPA) is a runtime guard — it checks the actual plan result against organizational policy. Both complement each other, they're not replacements. A good platform lets you run both.

Real-World Adoption Scenario

So it doesn't stay abstract, let's look at a realistic adoption scenario.

Case study: PT Maju Teknologi, 8 teams, 40 Terraform stacks.

  1. Initial condition. Every team has its own repo and GitHub Actions pipeline. There are 3 incidents in a year because developers applied from laptops, and 2 stacks broke because of state conflicts. The platform team spends ~30% of its time maintaining pipelines instead of writing infrastructure.
  2. Decision. After evaluating, they choose HCP Terraform because it's 100% Terraform (no syntax migration), Sentinel policies can be shared across teams, and Vault integration for secrets is built-in.
  3. Migration. All backend "s3" blocks are replaced with cloud blocks (leaving only a few for regulated data). The 40 stacks are migrated into 40 workspaces organized in per-team projects. GitHub Actions pipelines are trimmed — only bootstrap and non-Terraform tasks remain.
  4. Result. No more applying from laptops (SSO login to the platform is required). Central policies block public S3 and untagged resources across all teams. A central audit log satisfies compliance needs. The platform team shifts from "maintaining pipelines" to "writing policies & improving architecture".

Tip

The recommended migration pattern: start with one team and one stack (e.g. a non-critical stack), measure the impact, then expand. Don't migrate 40 stacks at once in the first week — platforms also need a "trusted" period. Use terraform init -migrate-state when moving from an old backend to a new workspace, exactly the pattern we learned in episode 5.

When Should You Use a Managed Platform? (Pros & Considerations)

So your decision is well-informed, let's summarize the advantages and the things to consider:

AdvantagesConsiderations / Disadvantages
State, runners, and pipeline fully managedMonthly subscription cost (scaled per user/run)
Built-in policy + RBAC + auditData (state) resides with a third-party provider
Out-of-the-box VCS integration & approvalDependence on the vendor (vendor lock-in)
Self-service for developersInitial configuration (organization, project, workspace) takes time
Technically eliminates "applying from laptops"Can feel like overkill for very small teams
Built-in private module registryOptional: needs a team/owner to manage standards

Note

A rule of thumb widely used by practitioners: below ~5 stacks & 1–2 teams, self-managed CI/CD (episode 13) is still sufficient and cheaper. Above that — many teams, centralized policy needs, and audit demands — managed IaC platforms start to be far cheaper in total cost of ownership, because platform team time is very valuable.

Common Managed Platform Pitfalls

MistakeSymptomSolution
Using the cloud block without realizing state movesSensitive data at the vendor without approvalAudit first, choose a regulation-compliant platform
Not using the policy enginePlatform's safety net inactiveEnable default policies + write organizational policies
Migrating 40 stacks at onceConfusion & incidents on day oneStart with non-critical stacks, incrementally
Forgetting terraform init -migrate-stateOld state doesn't carry over → resources become orphanedUse the migrate flag when switching backends
Removing the old CI/CD pipeline entirelyLosing non-Terraform tool integrationCombine: platform for Terraform, CI/CD for the rest
Letting everyone be a workspace adminApproval & RBAC become meaninglessApply minimal roles: developers plan, owners apply

Conclusion

In this episode 14 we discussed how managed IaC platforms — HCP Terraform, Spacelift, env0, and Scalr — take over the components we built manually in episode 13: remote execution, VCS integration, managed state management, private module registry, and policy enforcement. We also saw that the VCS-driven flow on these platforms is actually a ready-made implementation of the "no applying from laptops" principle with an approval gate, which we previously had to assemble ourselves in YAML workflows.

Key takeaways to bring home:

  • Managed platforms are a management layer on top of Terraform, not a replacement for it.
  • Five core features: remote runner, VCS integration, managed state, private module registry, policy enforcement.
  • The cloud block moves state and execution to the platform; understand its implications for data security.
  • Policy engines (Sentinel/OPA) are runtime guards that complement static scans like Checkov.
  • Adoption makes the most sense when the organization has many teams & stacks, where the cost of maintaining pipelines exceeds the subscription cost.

In the next episode 15, we'll dive into a topic that's been touched on over the last few episodes — Secret Management & State Security — discussing why state files store secrets in plaintext, how to secure them with encryption & IAM, and how to pull secrets from HashiCorp Vault, AWS Secrets Manager, or SOPS with sensitive = true. Stay excited!

Learn Terraform - Managed IaC Platforms (Terraform Cloud / Spacelift) | Learn Terraform