Skip to content

Commit bf749f0

Browse files
Merge branch 'main' into jspiker/user-token-enablement
2 parents 799db94 + 18df827 commit bf749f0

File tree

66 files changed

+4508
-1044
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+4508
-1044
lines changed

.github/actions/test-go-tfe/action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ runs:
9797
GITHUB_REGISTRY_MODULE_IDENTIFIER: "hashicorp/terraform-random-module"
9898
GITHUB_REGISTRY_NO_CODE_MODULE_IDENTIFIER: "hashicorp/terraform-random-no-code-module"
9999
OAUTH_CLIENT_GITHUB_TOKEN: "${{ inputs.oauth-client-github-token }}"
100+
SKIP_HYOK_INTEGRATION_TESTS: "${{ inputs.skip-hyok-integration-tests }}"
101+
HYOK_ORGANIZATION_NAME: "${{ inputs.hyok-organization-name }}"
102+
HYOK_WORKSPACE_NAME: "${{ inputs.hyok-workspace-name }}"
103+
HYOK_POOL_ID: "${{ inputs.hyok-pool-id }}"
104+
HYOK_PLAN_ID: "${{ inputs.hyok-plan-id }}"
105+
HYOK_STATE_VERSION_ID: "${{ inputs.hyok-state-version-id }}"
106+
HYOK_CUSTOMER_KEY_VERSION_ID: "${{ inputs.hyok-customer-key-version-id }}"
107+
HYOK_ENCRYPTED_DATA_KEY_ID: "${{ inputs.hyok-encrypted-data-key-id }}"
100108
GO111MODULE: "on"
101109
ENABLE_TFE: ${{ inputs.enterprise }}
102110
run: |

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,28 @@
33
## Enhancements
44
* Adds `UserTokensEnabled` field to `Organization` to support enabling/disabling user tokens for an organization by @JarrettSpiker [#???](https://github.com/hashicorp/go-tfe/pull/??)
55

6+
# v1.93.0
7+
8+
## Enhancements
9+
* Exports the StackConfiguration UploadTarGzip receiver function [#1219](https://github.com/hashicorp/go-tfe/pull/1219)
10+
* Updates BETA stacks resource schemas to match latest API spec by @ctrombley [#1220](https://github.com/hashicorp/go-tfe/pull/1220)
11+
* Adds support for Hold Your Own Key by @helenjw , @iuri-slywitch-hashicorp and @dominic-retli-hashi [#1201](https://github.com/hashicorp/go-tfe/pull/1201)
12+
13+
## Deprecations
14+
15+
* The beta `StackDeployments`, `StackPlan`, `StackPlanOperation`, and `StackSource` resources have been removed, by @sahar-azizighannad [#1205](https://github.com/hashicorp/go-tfe/pull/1205)
16+
17+
# v1.92.0
18+
19+
## Enhancements
20+
21+
* Adds BETA support for performing Registry Module test runs on custom Agents by @hashimooon [#1209](httpsLhttps://github.com/hashicorp/go-tfe/pull/1209)
22+
* Adds support for managing agent pools on `Stacks` by @maed223 [#1214](https://github.com/hashicorp/go-tfe/pull/1214)
23+
24+
## Bug Fixes
25+
26+
* Fixes arch validation on Terraform, OPA, and Sentinel Tool Versions when providing top level `url` and `sha` with multiple `archs` by @kelsi-hoyle [#1212](https://github.com/hashicorp/go-tfe/pull/1212)
27+
628
# v1.91.1
729

830
## Bug Fixes

admin_opa_version.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,11 @@ func (o AdminOPAVersionCreateOptions) validArch() bool {
213213
return true
214214
}
215215

216-
emptyToolVersionFields := o.URL == "" && o.SHA == ""
217-
218216
for _, a := range o.Archs {
219-
if !validArch(a) || !emptyToolVersionFields && (o.URL != a.URL || o.SHA != a.Sha) {
217+
if !validArch(a) {
220218
return false
221219
}
222220
}
221+
223222
return true
224223
}

admin_opa_version_integration_test.go

Lines changed: 58 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,61 @@ func TestAdminOPAVersions_CreateDelete(t *testing.T) {
102102
client := testClient(t)
103103
ctx := context.Background()
104104
version := createAdminOPAVersion()
105+
url := "https://www.hashicorp.com"
106+
amd64Sha := *String(genSha(t))
107+
108+
t.Run("with valid options including top level url & sha and archs", func(t *testing.T) {
109+
opts := AdminOPAVersionCreateOptions{
110+
Version: version,
111+
Deprecated: Bool(true),
112+
DeprecatedReason: String("Test Reason"),
113+
Official: Bool(false),
114+
Enabled: Bool(false),
115+
Beta: Bool(false),
116+
URL: url,
117+
SHA: amd64Sha,
118+
119+
Archs: []*ToolVersionArchitecture{
120+
{
121+
URL: url,
122+
Sha: amd64Sha,
123+
OS: linux,
124+
Arch: amd64,
125+
},
126+
{
127+
URL: url,
128+
Sha: *String(genSha(t)),
129+
OS: linux,
130+
Arch: arm64,
131+
}},
132+
}
133+
ov, err := client.Admin.OPAVersions.Create(ctx, opts)
134+
require.NoError(t, err)
135+
136+
defer func() {
137+
deleteErr := client.Admin.OPAVersions.Delete(ctx, ov.ID)
138+
require.NoError(t, deleteErr)
139+
}()
140+
141+
assert.Equal(t, opts.Version, ov.Version)
142+
assert.Equal(t, *opts.Official, ov.Official)
143+
assert.Equal(t, *opts.Deprecated, ov.Deprecated)
144+
assert.Equal(t, *opts.DeprecatedReason, *ov.DeprecatedReason)
145+
assert.Equal(t, *opts.Enabled, ov.Enabled)
146+
assert.Equal(t, *opts.Beta, ov.Beta)
147+
assert.Equal(t, len(opts.Archs), len(ov.Archs))
148+
assert.Equal(t, opts.URL, ov.URL)
149+
assert.Equal(t, opts.SHA, ov.SHA)
150+
for i, arch := range opts.Archs {
151+
assert.Equal(t, arch.URL, ov.Archs[i].URL)
152+
assert.Equal(t, arch.Sha, ov.Archs[i].Sha)
153+
assert.Equal(t, arch.OS, ov.Archs[i].OS)
154+
assert.Equal(t, arch.Arch, ov.Archs[i].Arch)
155+
}
156+
})
105157

106158
t.Run("with valid options including archs", func(t *testing.T) {
159+
version = createAdminOPAVersion()
107160
opts := AdminOPAVersionCreateOptions{
108161
Version: version,
109162
Deprecated: Bool(true),
@@ -125,9 +178,9 @@ func TestAdminOPAVersions_CreateDelete(t *testing.T) {
125178
Arch: arm64,
126179
}},
127180
}
181+
128182
ov, err := client.Admin.OPAVersions.Create(ctx, opts)
129183
require.NoError(t, err)
130-
131184
defer func() {
132185
deleteErr := client.Admin.OPAVersions.Delete(ctx, ov.ID)
133186
require.NoError(t, deleteErr)
@@ -151,7 +204,7 @@ func TestAdminOPAVersions_CreateDelete(t *testing.T) {
151204
t.Run("with valid options including, url, and sha", func(t *testing.T) {
152205
opts := AdminOPAVersionCreateOptions{
153206
Version: version,
154-
URL: "https://www.hashicorp.com",
207+
URL: url,
155208
SHA: genSha(t),
156209
Deprecated: Bool(true),
157210
DeprecatedReason: String("Test Reason"),
@@ -218,13 +271,13 @@ func TestAdminOPAVersions_CreateDelete(t *testing.T) {
218271
Version: version,
219272
Archs: []*ToolVersionArchitecture{
220273
{
221-
URL: "https://www.hashicorp.com",
222-
Sha: *String(genSha(t)),
274+
URL: url,
275+
Sha: amd64Sha,
223276
OS: linux,
224277
Arch: amd64,
225278
},
226279
{
227-
URL: "https://www.hashicorp.com",
280+
URL: url,
228281
Sha: *String(genSha(t)),
229282
OS: linux,
230283
Arch: arm64,

admin_sentinel_version.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,11 @@ func (o AdminSentinelVersionCreateOptions) validArch() bool {
213213
return true
214214
}
215215

216-
emptyToolVersionFields := o.URL == "" && o.SHA == ""
217-
218216
for _, a := range o.Archs {
219-
if !validArch(a) || !emptyToolVersionFields && (o.URL != a.URL || o.SHA != a.Sha) {
217+
if !validArch(a) {
220218
return false
221219
}
222220
}
221+
223222
return true
224223
}

admin_sentinel_version_integration_test.go

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,24 +102,75 @@ func TestAdminSentinelVersions_CreateDelete(t *testing.T) {
102102
client := testClient(t)
103103
ctx := context.Background()
104104
version := createAdminSentinelVersion()
105+
url := "https://www.hashicorp.com"
106+
amd64Sha := String(genSha(t))
105107

106-
t.Run("with valid options including archs", func(t *testing.T) {
108+
t.Run("with valid options including top level url & sha and archs", func(t *testing.T) {
107109
opts := AdminSentinelVersionCreateOptions{
108110
Version: version,
109111
Deprecated: Bool(true),
110112
DeprecatedReason: String("Test Reason"),
111113
Official: Bool(false),
112114
Enabled: Bool(false),
113115
Beta: Bool(false),
116+
URL: url,
117+
SHA: *amd64Sha,
114118
Archs: []*ToolVersionArchitecture{
115119
{
116-
URL: "https://www.hashicorp.com",
120+
URL: url,
121+
Sha: *amd64Sha,
122+
OS: linux,
123+
Arch: amd64,
124+
},
125+
{
126+
URL: url,
117127
Sha: *String(genSha(t)),
118128
OS: linux,
129+
Arch: arm64,
130+
}},
131+
}
132+
sv, err := client.Admin.SentinelVersions.Create(ctx, opts)
133+
require.NoError(t, err)
134+
135+
defer func() {
136+
deleteErr := client.Admin.SentinelVersions.Delete(ctx, sv.ID)
137+
require.NoError(t, deleteErr)
138+
}()
139+
140+
assert.Equal(t, opts.Version, sv.Version)
141+
assert.Equal(t, *opts.Official, sv.Official)
142+
assert.Equal(t, *opts.Deprecated, sv.Deprecated)
143+
assert.Equal(t, *opts.DeprecatedReason, *sv.DeprecatedReason)
144+
assert.Equal(t, *opts.Enabled, sv.Enabled)
145+
assert.Equal(t, *opts.Beta, sv.Beta)
146+
assert.Equal(t, opts.URL, sv.URL)
147+
assert.Equal(t, opts.SHA, sv.SHA)
148+
assert.Equal(t, len(opts.Archs), len(sv.Archs))
149+
for i, arch := range opts.Archs {
150+
assert.Equal(t, arch.URL, sv.Archs[i].URL)
151+
assert.Equal(t, arch.Sha, sv.Archs[i].Sha)
152+
assert.Equal(t, arch.OS, sv.Archs[i].OS)
153+
assert.Equal(t, arch.Arch, sv.Archs[i].Arch)
154+
}
155+
})
156+
157+
t.Run("with valid options including archs", func(t *testing.T) {
158+
opts := AdminSentinelVersionCreateOptions{
159+
Version: version,
160+
Deprecated: Bool(true),
161+
DeprecatedReason: String("Test Reason"),
162+
Official: Bool(false),
163+
Enabled: Bool(false),
164+
Beta: Bool(false),
165+
Archs: []*ToolVersionArchitecture{
166+
{
167+
URL: url,
168+
Sha: *amd64Sha,
169+
OS: linux,
119170
Arch: amd64,
120171
},
121172
{
122-
URL: "https://www.hashicorp.com",
173+
URL: url,
123174
Sha: *String(genSha(t)),
124175
OS: linux,
125176
Arch: arm64,
@@ -151,8 +202,8 @@ func TestAdminSentinelVersions_CreateDelete(t *testing.T) {
151202
t.Run("with valid options including url, and sha", func(t *testing.T) {
152203
opts := AdminSentinelVersionCreateOptions{
153204
Version: version,
154-
URL: "https://www.hashicorp.com",
155-
SHA: genSha(t),
205+
URL: url,
206+
SHA: *amd64Sha,
156207
Deprecated: Bool(true),
157208
DeprecatedReason: String("Test Reason"),
158209
Official: Bool(false),
@@ -186,8 +237,8 @@ func TestAdminSentinelVersions_CreateDelete(t *testing.T) {
186237
version = createAdminSentinelVersion()
187238
opts := AdminSentinelVersionCreateOptions{
188239
Version: version,
189-
URL: "https://www.hashicorp.com",
190-
SHA: genSha(t),
240+
URL: url,
241+
SHA: *amd64Sha,
191242
}
192243
sv, err := client.Admin.SentinelVersions.Create(ctx, opts)
193244
require.NoError(t, err)
@@ -220,8 +271,8 @@ func TestAdminSentinelVersions_CreateDelete(t *testing.T) {
220271
Version: version,
221272
Archs: []*ToolVersionArchitecture{
222273
{
223-
URL: "https://www.hashicorp.com",
224-
Sha: *String(genSha(t)),
274+
URL: url,
275+
Sha: *amd64Sha,
225276
OS: linux,
226277
Arch: amd64,
227278
},

admin_terraform_version.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,12 @@ func (o AdminTerraformVersionCreateOptions) validArchs() bool {
227227
return true
228228
}
229229

230-
emptyToolVersionFields := !validString(o.URL) && !validString(o.Sha)
231-
232230
for _, a := range o.Archs {
233-
if !validArch(a) || !emptyToolVersionFields && (*o.URL != a.URL || *o.Sha != a.Sha) {
231+
if !validArch(a) {
234232
return false
235233
}
236234
}
235+
237236
return true
238237
}
239238

0 commit comments

Comments
 (0)