Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: run actions don't accept json-api resource request bodies #388

merged 1 commit into from May 4, 2022


Copy link

@brandonc brandonc commented May 2, 2022


According to the docs and in practice, the run actions group of endpoints commonly accept a request body with a single "comment" attribute. This isn't a json-api resource document, and it shouldn't be encoded into a "data" → "attributes" nesting.

As far as I know, these are the only request bodies that aren't compliant, and it's not worthwhile to convert these endpoints from actions to resources.

Testing plan

I added an integration test for this in particular, but I also I wrote a simple program to POST a run apply to a service like so you can see the request body:

package main

import (


func main() {
	client, err := tfe.NewClient(&tfe.Config{
		Address: "",
		Token:   "",

	if err != nil {

	err = client.Runs.Apply(context.Background(), "run-NjC97hxkfWZ4eHTA", tfe.RunApplyOptions{
		Comment: tfe.String("hello, world"),

	if err != nil {

External links

@brandonc brandonc force-pushed the brandonc/apply_comment branch from 09897de to 5b06ba0 Compare May 3, 2022
Uk1288 approved these changes May 3, 2022
Copy link

@Uk1288 Uk1288 left a comment

LGTM 🎉 , tested the run actions (Discard, apply, cancel) locally.

Copy link

@sebasslash sebasslash left a comment

The docs are subtle, excellent catch!

@brandonc brandonc merged commit 4fc5745 into main May 4, 2022
4 checks passed
@brandonc brandonc deleted the brandonc/apply_comment branch May 4, 2022
Copy link

github-actions bot commented May 4, 2022

Reminder to the contributor that merged this PR: if your changes have added important functionality or fixed a relevant bug, open a follow-up PR to update with a note on your changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants