Securing Infrastructure at Scale: Introducing Pinterest’s Resource Provisioner Pipeline (RPP)
Managing Infrastructure as Code in a large, distributed organization like Pinterest presents significant security and logistical hurdles. To address this, Pinterest developed the Resource Provisioner Pipeline (RPP), a proprietary Terraform execution engine. RPP ensures secure management of both critical and non-critical infrastructure changes within a multi-repository setup. This system provides compliance and robust security for global AWS operations through dual controls, centralized GitHub Actions, and secure role-chaining. RPP manages hundreds of Terraform workspaces, governing tens of thousands of AWS resources including security policies, networking, and compute. The RPP GitHub workflow operates on a centralized execution model, triggered by PR events. It uses composite GitHub Actions and isolates workspace impact by executing plans for each workspace independently. Dual controls add an essential human review layer, requiring approval from a code reviewer. To enforce least privilege, RPP implements a strict workspace-path-role mapping using secure role-chaining. The process starts with assuming a centralized RPPActionsRole authenticated via GitHub OIDC. It then determines workspace properties, mapping them to allowed repositories, paths, and execution roles. A critical backend validation ensures code paths strictly reference the correct S3 state backend and KMS keys for the designated workspace. If validation passes, the RPPActionsRole assumes a down-scoped team IAM role, ensuring minimal permissions. The deployment process includes linting, planning with output on the PR, and deliberate application triggered by a specific comment. This approach offers benefits like unified auditing, instant systemic patches, and centralized resource metrics.