Skip to content

Alex Stephen

2 posts by Alex Stephen

AEP Terraform Provider

A core thesis of the AEP project has been that API design constraints can facilitate the creation (and maintenance!) of API client tools. In many companies, teams are staffed to build out CLI tools, Terraform providers, UIs, LLM agents, and various other tools that act as thin layers on top of a company’s APIs. The AEP project aims to ensure that these tools can be easily generated on top of our API design, ensuring that companies can move faster with less overall effort. We’re excited to launch our first version of a fully auto-generated Terraform provider based off the AEPs.

What is Terraform?

Terraform is a powerful Infrastructure-as-Code (IaC) tool that allows you to define and manage your infrastructure using code. Infrastructure-as-Code, in general, is the practice of managing and provisioning infrastructure through machine-readable definition files rather than through manual processes. This means you can automate the creation, modification, and deletion of resources across various cloud providers and on-premises environments, ensuring consistency, repeatability, and version control.

Cloud companies often build out Terraform providers, which are responsible for establishing differences between the cloud and the user’s intent, determining which API requests are necessary, making those requests, and handling any follow-up actions.

How do the AEPs help with this?

Most companies must staff engineers just to maintain their Terraform provider. However, making AEP-compliant APIs can give you providers for no additional effort beyond writing the API! Let’s take a look at a pseudocode version of the Terraform lifecycle.

userIntention := GetTerraformPlan()
currentState := ReadResource(userIntention)
if currentState != null:
if user wishes to delete:
DeleteResource(currentState)
else if currentState != userIntention:
UpdateResource(userIntention)
else:
CreateResource(userIntention)

Two different sets of problems emerge and the AEPs are well-suited for solving both of them.

The first set of problems revolves around the grouping and calling of APIs. There’s a variety of tools in the market that will call an API method given a set of parameters and an OpenAPI description (or even just a URL). Terraform doesn’t expose individual API methods, but instead exposes a resource schema. This raises a variety of questions when developing a Terraform provider:

  • What are my resources?
  • How do I know which API methods to call for a given resource?
  • Is there a single API method that can be called for each CRUD operation, or will I need to chain together API calls to achieve my result?
  • How do I derive my resource schema from four distinct CRUD APIs? Is it simply the union of all the body parameters from the four CRUD API methods?

AEP APIs are resource-oriented by default, so just following the AEPs can address all of the problems above. The Terraform provider can “know” which API methods should be called and how they relate to each other.

What about API responses?

The second set of problems comes from reading API responses. In the pseudocode above, the Read response needs to be parsed and checked against the Terraform plan. This means that the Terraform provider needs to understand the relationship between the API response (beyond simple error checking) and the user’s intention. More questions emerge:

  • Does the response of the Read API match the resource schema? What changes need to be made to match the Read API response to the potential resource schema?
  • Are there multiple ways that the server will accept a single value? If so, how can I be sure that two semantically equivalent values do not result in a diff against the Terraform plan?
  • If a boolean value does not appear in the JSON response, does that mean it’s false? (And likewise for numeric values being 0, string values being the empty string, and so on.)

Many of these questions come down to the preference of the API developer. In fact, some of them cannot be defined by an API schema! The AEPs encode these differences in our specification, so that tools like our Terraform provider can make assumptions about how to parse the responses of our APIs.

The AEP Terraform Provider

The AEP Terraform provider solves these problems. The provider is a template that can be pointed to any OpenAPI spec that features APIs complying with the AEPs. Since the APIs are resource-oriented and AEP-compliant, the provider is able to create a resource schema at runtime that perfectly matches the APIs. Did your team build a new feature? Just update your OpenAPI spec and the provider will add it without users having to update their providers.

Users are able to send over arbitrary headers so that the provider will work with any authentication solution you may have.

When users run terraform apply, the provider automatically knows how to create Create, Read, Update, and Delete requests, handle authentication, and return errors. More crucially, it understands how to handle the responses from those requests. The provider understands what values to expect from the Get requests and the proper way to handle difference checking against the user’s intention.

What comes next?

While the Terraform provider lifecycle appears simple at first glance, the details contain a deceptive amount of detail. This is detail that can only be learned through trial-and-error, which is difficult when APIs are often only designed once.

By building out the Terraform provider, we’re even more convinced than ever that the AEP specification can prove the thesis that client tooling can be more easily built on top of consistent APIs.

AEP's 2024 Year in Review

Building Better APIs Together: AEP’s 2024 Year in Review

As we close out 2024, we want to share the significant strides the API Enhancement Proposals (AEP) project has made in creating a more cohesive API ecosystem. What started as a fork of Google’s API Improvement Proposals has evolved into something much more ambitious: an open, community-driven standard for building resource-oriented APIs that work consistently across different protocols and platforms.

A brief summary of the achievements outlined below are:

  • The creation of aepc, an AEP “compiler” that takes a succinct resource definition and generates protobuf and OpenAPI schemas.
  • The 0.1 release of aepcli, which can consume aep-compliant APIs and generate a resource-oriented command-line-interfaces dynamically.
  • A complete linter for protobuf APIs, and starting an OAS variant.
  • aep-explorer: a prototype of a WEB UI to explore aep-compliant APIs.
  • A redesigned website (aep.dev), where this blog post is published!

The Vision Takes Shape

This year clarified our core belief that API design shouldn’t be a bikeshedding honeypot. By collecting hard-won design patterns from across the industry, we’ve worked to narrow the decisions API producers need to make while improving the experience for API consumers. Our approach focuses on resource-oriented design principles that can be expressed in both Protocol Buffers and OpenAPI, making AEPs protocol-agnostic while maintaining strong opinions about what makes APIs more usable and maintainable.

Major Technical Achievements

aepc: The AEP compiler

We introduced aepc, our service compiler that transforms concise resource definitions into fully-specified APIs. With just a few dozen lines of YAML describing your resources and their relationships, aepc generates complete Protocol Buffer and OpenAPI specifications that adhere to AEP standards. This dramatically reduces the boilerplate needed to create consistent APIs while enforcing best practices through generation rather than just validation.

aepc is just a prototype with no official release at this moment, but it has been very useful, producing AEP-compliant OpenAPI and protobuf specifications that are used as examples in the specification.

aepcli: A Command-Line Interface for Everyone

The launch of version 0.1 of aepcli marked a significant milestone in our tooling journey. Rather than requiring every API provider to build their own CLI, aepcli dynamically generates a powerful command-line interface from any AEP-compliant API’s OpenAPI specification. This client-side approach means new API features are immediately available without requiring CLI updates, solving a common pain point in API tooling.

aep-explorer

To complement our command-line tools, we developed a web-based UI for browsing and interacting with AEP-compliant APIs: aep-explorer . This provides a more visual way to understand and experiment with APIs while maintaining the same consistent interaction patterns that make AEPs valuable.

Enhanced Linting Capabilities

A major focus this year was improving our linting capabilities, particularly for OpenAPI specifications. Mike Kistler led the effort to revitalize our OpenAPI linter, implementing rules for key AEPs including AEP-132 (List methods) and AEP-135. The linter helps teams validate their APIs against AEP guidance, catching common issues early in the development process.

Significantly progress was also made for our protobuf linter, which is now compliant with all of the updated guidance in aep.dev.

The linter’s approach balances pragmatism with standards enforcement - while some rules are mandatory, others can be selectively adopted based on an organization’s needs. This flexibility helps teams gradually adopt AEP practices while maintaining consistent APIs. The project uses Spectral as its foundation, allowing teams to build on an established tooling ecosystem while adding AEP-specific validations.

To help teams get started, we’ve included comprehensive test cases and example APIs that demonstrate proper implementation of AEP patterns. The linter has already helped identify areas where our documentation needed clarification, particularly around operation IDs and resource naming conventions.

Improved Infrastructure

A major focus this year was improving the components used for learning about the AEP standards and enforcing them in our organization.

To help teams get started, we’ve built comprehensive test cases and example APIs that demonstrate proper implementation of AEP patterns. The linters have already helped identify areas where our documentation needed clarification, particularly around operation IDs and resource naming conventions.

Additionally, we’ve built out a new aep.dev website based on a new framework to help highlight our guidance and to help the team release new content over time.

Community Growth

The March Barn Raising

On Pi Day (March 14), we held our first community “barn raising” event, bringing together contributors from across companies and time zones. The event focused on improving documentation, adding OpenAPI examples, and making AEPs more accessible to newcomers. This collaborative effort helped us identify and address gaps in our guidance while strengthening our community bonds.

Expanding Global Reach

Recognizing our growing international community, we established EU-friendly meeting times and welcomed contributors from companies like DoubleVerify, providing valuable feedback on real-world AEP adoption. This led to improvements in our documentation and examples, particularly around pagination and custom methods.

Educational Content

We launched the @aepdev YouTube channel featuring detailed demonstrations of our tooling and explanations of AEP concepts. These videos help newcomers understand both the technical details and the broader vision of what we’re building.

Looking Forward to 2025

As we enter the new year, our focus areas include:

  1. Expanding our linting tools across both Protocol Buffer and OpenAPI specifications
  2. Building more client generators, including Terraform providers and Kubernetes operators
  3. Working with the OpenAPI community on resource-oriented API patterns
  4. Supporting more companies in adopting AEPs, with clear migration paths and tooling support

Get Involved

We’re building AEPs in the open and welcome contributions of all kinds. You can join us:

  • On CNCF Slack in the #aep channel
  • At our weekly community meetings (Fridays at 11:30am PT)
  • On GitHub at github.com/aep-dev
  • Through our documentation at aep.dev

Whether you’re building new APIs or working to improve existing ones, we believe AEPs can help make that process more consistent and maintainable. Join us in building better APIs together!