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

Add Admin Terraform Versions API #186

Merged
merged 5 commits into from
Mar 9, 2021

Conversation

omarismail
Copy link
Contributor

Description

This PR adds all the Admin TerraformVersions API.

It implements:

  • List: lists all terraform versions
  • Read: reads a specific version
  • Create: creates a terraform version
  • Update: updates a specific terraform version
  • Delete: deletes a terraform version

Testing plan

  1. Pull down the code and run the tests.

Output from tests

$ TFE_TOKEN=<token> TFE_ADDRESS=<address>  ENABLE_TFE=1 go test -v ./...  -timeout=30m
PASS
ok  	github.com/hashicorp/go-tfe	533.924s
?   	github.com/hashicorp/go-tfe/examples/organizations	[no test files]
?   	github.com/hashicorp/go-tfe/examples/workspaces	[no test files]

External links

@omarismail omarismail marked this pull request as ready for review March 5, 2021 17:32
@omarismail omarismail requested a review from a team March 5, 2021 17:32
Copy link
Member

@chrisarcand chrisarcand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sooo excited for this one.

admin_terraform_version.go Outdated Show resolved Hide resolved
admin_terraform_version.go Outdated Show resolved Hide resolved
admin_terraform_version.go Show resolved Hide resolved
admin_terraform_version.go Outdated Show resolved Hide resolved
admin_terraform_version.go Outdated Show resolved Hide resolved
Copy link
Member

@chrisarcand chrisarcand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// AdminTerraformVersionUpdateOptions for updating terraform version.
// https://www.terraform.io/docs/cloud/api/admin/terraform-versions.html#request-body
type AdminTerraformVersionUpdateOptions struct {
Type string `jsonapi:"primary,terraform-versions"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like what you landed on here, with Type used in *Options but leaving the necessary tag as ID in the struct (since jsonapi does say it should be used on the primary key) Nice work!

One thing I'd consider adding in your followup is a docstring indicating what this is for in each *Options (something far more helpful than "Internal use only!"); maybe even just See /link/to/readme 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄 .

adding in your followup is a docstring indicating what this is for

👍 will do

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

Successfully merging this pull request may close these issues.

2 participants