Skip to content

Commit

Permalink
Use json instead of jsonapi for Archs
Browse files Browse the repository at this point in the history
  • Loading branch information
natalie-todd committed Jan 9, 2025
1 parent 2b26a23 commit 9fad112
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

* Add support for team notification configurations @notchairmk [#1016](https://github.com/hashicorp/go-tfe/pull/1016)

## Bug Fixes

* Fixes a bug in BETA support for Linux arm64 agents, which is EXPERIMENTAL, SUBJECT TO CHANGE, and may not be available to all users @natalie-todd [#1022](https://github.com/hashicorp/go-tfe/pull/1022)

# v1.72.0

## Enhancements
Expand Down
9 changes: 4 additions & 5 deletions admin_terraform_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ type AdminTerraformVersion struct {
}

type ToolVersionArchitecture struct {
URL string `jsonapi:"attr,url"`
Sha string `jsonapi:"attr,sha"`
OS string `jsonapi:"attr,os"`
Arch string `jsonapi:"attr,arch"`
URL string `json:"url"`
Sha string `json:"sha"`
OS string `json:"os"`
Arch string `json:"arch"`
}

// AdminTerraformVersionsListOptions represents the options for listing
Expand Down Expand Up @@ -168,7 +168,6 @@ func (a *adminTerraformVersions) Create(ctx context.Context, options AdminTerraf
if err != nil {
return nil, err
}

return tfv, nil
}

Expand Down
25 changes: 14 additions & 11 deletions admin_terraform_version_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,25 +100,28 @@ func TestAdminTerraformVersions_CreateDelete(t *testing.T) {

client := testClient(t)
ctx := context.Background()
version := genSafeRandomTerraformVersion()

t.Run("with valid options", func(t *testing.T) {
sha := String(genSha(t))
opts := AdminTerraformVersionCreateOptions{
Version: String(version),
URL: String("https://www.hashicorp.com"),
Sha: sha,
Version: String(genSafeRandomTerraformVersion()),
Deprecated: Bool(true),
DeprecatedReason: String("Test Reason"),
Official: Bool(false),
Enabled: Bool(false),
Beta: Bool(false),
Archs: []*ToolVersionArchitecture{{
URL: "https://www.hashicorp.com",
Sha: *sha,
OS: linux,
Arch: amd64,
}},
Archs: []*ToolVersionArchitecture{
{
URL: "https://www.hashicorp.com",
Sha: *String(genSha(t)),
OS: linux,
Arch: amd64,
},
{
URL: "https://www.hashicorp.com",
Sha: *String(genSha(t)),
OS: linux,
Arch: arm64,
}},
}
tfv, err := client.Admin.TerraformVersions.Create(ctx, opts)
require.NoError(t, err)
Expand Down

0 comments on commit 9fad112

Please sign in to comment.