Executive Overview

RPP is a custom-built Terraform execution engine designed to bring rigorous governance, least-privilege access enforcement, and dual-control reviews to Pinterest’s vast Amazon Web Services (AWS) infrastructure. Running thousands of critical cloud resources—spanning Identity and Access Management (IAM) policies, Virtual Private Clouds (VPCs), application load balancers, Amazon S3 buckets, and complex Kubernetes clusters—requires absolute operational safety.

For years, Pinterest’s infrastructure-as-code (IaC) configuration has been distributed across a sprawling, multi-repository landscape owned by dozens of distinct engineering teams. While a long-term migration toward a unified mono-repository remains underway, the immediate security risks posed by this decentralized reality could not wait. Granting continuous integration and continuous deployment (CI/CD) pipelines broad, sweeping permissions to execute changes across disparate repositories and production AWS accounts introduces catastrophic vectors for accidental misconfigurations and malicious compromise.

Pinterest engineered RPP to bridge this operational gap. By decoupling execution logic from individual repositories and centralizing it within a heavily guarded, OIDC-secured pipeline, Pinterest has established a masterclass in modern cloud security engineering. This article examines the architectural mechanics of RPP, its alignment with industry practices pioneered by tech giants like Mercari and Slack, and the broader lessons it offers platform engineering teams struggling with multi-repo IaC governance.


Detailed Chronology: The Evolution and Mechanics of RPP

To understand the necessity of the Resource Provisioner Pipeline, one must first examine the inherent vulnerabilities of traditional, decentralized CI/CD workflows. Historically, engineering teams managing cloud infrastructure via Terraform rely heavily on localized automation scripts embedded within their respective code repositories.

The Multi-Repo Dilemma

At Pinterest, Terraform code was scattered across a multitude of distinct codebases. Each repository operated independently, utilizing custom GitHub Actions workflows to run terraform plan and terraform apply. However, giving individual CI/CD runners direct access to powerful IAM credentials creates a high-risk security surface. If a single repository’s CI pipeline is compromised—via supply-chain attacks, vulnerable dependencies, or misconfigured repository secrets—an attacker gains a foothold capable of provisioning malicious infrastructure, tampering with state files, or exfiltrating sensitive data across connected AWS accounts.

Recognizing that a complete consolidation into a centralized mono-repository would take years of cross-functional migration effort, Pinterest’s infrastructure security and platform teams chose to build a secure execution layer that could operate safely within the existing multi-repository paradigm.

Transitioning to Centralized Composite Actions

The architectural heart of RPP is its shift away from per-repo execution scripts toward a central set of composite GitHub Actions. When a developer opens a pull request altering infrastructure code, RPP activates automatically via GitHub pull request events.

Instead of executing Terraform locally on an unverified runner with broad permissions, RPP orchestrates a meticulously gated, multi-stage workflow:

  1. Trigger and OIDC Validation: The workflow initiates by assuming a heavily restricted central IAM role known as RPPActionsRole. Access to this role is strictly regulated via OpenID Connect (OIDC) token validation, ensuring that only pre-authorized, authentic GitHub workflows can trigger the pipeline.
  2. Reading the Source of Truth: Once the central role is assumed, the pipeline queries a centralized configuration file. This critical registry acts as the single source of truth, mapping every individual Terraform workspace to its corresponding allowed repository, working directory, owning engineering team, and specific execution IAM role.
  3. Backend and KMS-Key Guardrail Checks: Before any role down-scoping or state mutation occurs, RPP executes a vital security validation step. It verifies that the path of the modified Terraform code strictly matches the designated Amazon S3 backend and AWS KMS key assigned to that specific workspace. This prevents a prevalent class of developer error: accidentally or maliciously linking one workspace’s directory to an unintended state file, which could corrupt cloud resources or leak state data.
  4. Role Down-Scoping and Workspace Execution: Only after passing backend verification does the pipeline drop its central privileges and assume the workspace-specific team role. With these tightly scoped permissions, RPP runs terraform fmt and terraform plan.
  5. Dual-Control Apply Phase: To prevent automated scripts from pushing untested or unreviewed changes to production, the actual terraform apply phase is locked behind a strict dual-control gate. It requires both formal code review sign-off from an approved reviewer on the owning repository and a clear, intentional human comment posted directly on the pull request.

Supporting Context & Metrics: Architecture and Ecosystem Impact

The structural philosophy behind RPP yields compounding benefits for platform reliability, security posture, and developer efficiency.

How Pinterest Secures AWS Infrastructure at Scale with a Centralized Terraform Pipeline

Centralized Control Points and Remediation

By centralizing execution into managed composite actions, Pinterest eliminated the operational nightmare of patching vulnerabilities across hundreds of isolated repositories. If an organization discovers a security flaw in its CI runner shell environment or a bug in its static analysis tooling, remediation happens in a single location.

Furthermore, this centralization empowers platform teams to enforce uniform quality gates across every single infrastructure change. Before any code reaches a production environment, RPP subjects it to:

  • Custom Semgrep Rules: Automated static analysis scanning for security anti-patterns, compliance violations, and known misconfigurations.
  • AI-Assisted Scanning: Advanced code analysis tools designed to catch subtle logical errors in cloud architecture definitions.
  • LocalStack-Based Dry Runs: Optional integration testing against mocked AWS behaviors, allowing engineers to validate complex Terraform scripts locally before interacting with real cloud accounts.

Comparative Analysis: How Pinterest Compares to Mercari and Slack

Securing centralized Infrastructure-as-Code pipelines is an industry-wide challenge that major technology companies have approached through distinct architectural lenses.

Company Primary Cloud Provider Core Architectural Approach Key Security Differentiator
Pinterest AWS Centralized Composite GitHub Actions with chained OIDC roles and workspace-to-path validation. Rigorous pre-assumption checks linking code paths directly to S3 backends and KMS keys to prevent state corruption.
Mercari GCP Terraform monorepo utilizing keyless Cloud Build credentials. Separation of duties via read-only "plan" service accounts and project-specific "apply" accounts using impersonation.
Slack Multi-Cloud / AWS Decentralized state ownership assigned directly to individual engineering teams. Strict gating enforcing sandbox and development environments before production promotion, paired with decentralized state management.

While Mercari focused heavily on GCP-native service account impersonation to isolate monorepo workspaces, and Slack emphasized decentralizing state ownership while gating promotions through development tiers, Pinterest’s RPP stands out for its obsessive focus on backend-block validation. By verifying the code-path-to-state-file relationship before assuming workspace roles, Pinterest defends against cross-workspace state corruption—a nuanced vulnerability that traditional role-mapping models often overlook.


Official Statements and Industry Insights

Engineering leaders within the cloud infrastructure space have long debated the merits of mono-repositories versus multi-repository ecosystems. Pinterest’s disclosure of the Resource Provisioner Pipeline highlights a pragmatic realization: forcing an immediate, enterprise-wide mono-repo migration is often politically and operationally unfeasible.

As architectural retrospectives note, security controls must meet engineering teams where they live. By building a private pipeline that honors the realities of a multi-repo environment while ruthlessly enforcing the principle of least privilege, Pinterest has demonstrated that architecture can adapt to organizational friction without sacrificing security.

While RPP itself is a proprietary, internal system rather than an open-source project, its core design patterns offer a blueprint for cloud architects worldwide. The separation of planning and applying into distinct, auditable actions—coupled with programmatic workspace-to-role mapping—provides a repeatable framework for any organization struggling to secure GitHub Actions or GitLab CI workflows interacting with hyperscale cloud providers.


Future Outlook: The Next Frontier of IaC Security

As infrastructure-as-code matures, the threat landscape surrounding CI/CD pipelines will continue to evolve. Attackers increasingly view CI/CD runners and deployment pipelines as soft underbellies, targeting them to gain lateral movement into cloud environments.

Pinterest’s implementation of RPP points toward a future where execution engines are entirely decoupled from application repositories. We can expect to see the broader platform engineering community adopt several trends inspired by models like RPP:

  1. Ephemeral Execution Environments: Moving away from persistent CI runners toward isolated, single-use execution pods that spin up with zero standing privileges, perform a single Terraform plan/apply operation via OIDC federation, and immediately self-destruct.
  2. Context-Aware State Protection: Integrating automated state-file integrity checks directly into cloud storage layers to ensure that Terraform state mutations can only originate from cryptographically verified, pipeline-controlled pathways.
  3. Policy-as-Code Integration: Embedding deeper compliance verification (using frameworks like Open Policy Agent or Rego) directly into the intermediary phase between OIDC role assumption and workspace execution, stopping non-compliant configurations before they ever reach the execution plan.

Conclusion

Pinterest’s Resource Provisioner Pipeline proves that organizational complexity does not have to compromise infrastructure security. By enforcing strict OIDC role chaining, automated backend validation, and dual-control human oversight across a decentralized multi-repo landscape, Pinterest has transformed its CI/CD pipeline from a potential security liability into a robust bastion of cloud governance. For platform engineering teams navigating the delicate balance between developer autonomy and enterprise security, RPP serves as a compelling, highly effective architectural model for the road ahead.