Skip to content

Commit 866b848

Browse files
authored
Merge branch 'main' into sams/migrate-opt-passed-provider
2 parents b4854fa + c161997 commit 866b848

Some content is hidden

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

48 files changed

+1862
-660
lines changed

.go-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.24.1
1+
1.24.2

CODEOWNERS

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
/internal/backend/remote-state/s3 @hashicorp/terraform-core @hashicorp/terraform-aws
2424
/internal/backend/remote-state/kubernetes @hashicorp/terraform-core @hashicorp/tf-eco-hybrid-cloud
2525

26+
# Cloud backend
27+
/internal/backend/remote @hashicorp/terraform-core @hashicorp/tf-core-cloud
28+
/internal/cloud @hashicorp/terraform-core @hashicorp/tf-core-cloud
29+
2630
# Provisioners
2731
builtin/provisioners/file @hashicorp/terraform-core
2832
builtin/provisioners/local-exec @hashicorp/terraform-core

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/hashicorp/terraform
22

3-
go 1.24.1
3+
go 1.24.2
44

55
godebug winsymlink=0
66

internal/backend/remote-state/azure/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/hashicorp/terraform/internal/backend/remote-state/azure
22

3-
go 1.24.1
3+
go 1.24.2
44

55
require (
66
github.com/hashicorp/go-azure-helpers v0.72.0

internal/backend/remote-state/consul/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/hashicorp/terraform/internal/backend/remote-state/consul
22

3-
go 1.24.1
3+
go 1.24.2
44

55
require (
66
github.com/hashicorp/consul/api v1.13.0

internal/backend/remote-state/cos/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/hashicorp/terraform/internal/backend/remote-state/cos
22

3-
go 1.24.1
3+
go 1.24.2
44

55
require (
66
github.com/hashicorp/terraform v0.0.0-00010101000000-000000000000

internal/backend/remote-state/gcs/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/hashicorp/terraform/internal/backend/remote-state/gcs
22

3-
go 1.24.1
3+
go 1.24.2
44

55
require (
66
cloud.google.com/go/kms v1.15.5

internal/backend/remote-state/kubernetes/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/hashicorp/terraform/internal/backend/remote-state/kubernetes
22

3-
go 1.24.1
3+
go 1.24.2
44

55
require (
66
github.com/hashicorp/terraform v0.0.0-00010101000000-000000000000

internal/backend/remote-state/oss/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/hashicorp/terraform/internal/backend/remote-state/oss
22

3-
go 1.24.1
3+
go 1.24.2
44

55
require (
66
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1501

internal/backend/remote-state/pg/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/hashicorp/terraform/internal/backend/remote-state/pg
22

3-
go 1.24.1
3+
go 1.24.2
44

55
require (
66
github.com/hashicorp/go-uuid v1.0.3

internal/backend/remote-state/s3/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/hashicorp/terraform/internal/backend/remote-state/s3
22

3-
go 1.24.1
3+
go 1.24.2
44

55
require (
66
github.com/aws/aws-sdk-go-v2 v1.36.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: BUSL-1.1
3+
4+
package e2etest
5+
6+
import (
7+
"bytes"
8+
"encoding/json"
9+
"os"
10+
"path/filepath"
11+
"testing"
12+
13+
"github.com/google/go-cmp/cmp"
14+
"github.com/hashicorp/terraform/internal/e2e"
15+
"github.com/hashicorp/terraform/internal/getproviders"
16+
)
17+
18+
// TestProvidersSchema is a test for `provider schemas -json` subcommand
19+
// which effectively tests much of the schema-related logic underneath
20+
func TestProvidersSchema(t *testing.T) {
21+
if !canRunGoBuild {
22+
// We're running in a separate-build-then-run context, so we can't
23+
// currently execute this test which depends on being able to build
24+
// new executable at runtime.
25+
//
26+
// (See the comment on canRunGoBuild's declaration for more information.)
27+
t.Skip("can't run without building a new provider executable")
28+
}
29+
t.Parallel()
30+
31+
tf := e2e.NewBinary(t, terraformBin, "testdata/provider-plugin")
32+
33+
// In order to do a decent end-to-end test for this case we will need a real
34+
// enough provider plugin to try to run and make sure we are able to
35+
// actually run it. Here will build the simple and simple6 (built with
36+
// protocol v6) providers.
37+
simple6Provider := filepath.Join(tf.WorkDir(), "terraform-provider-simple6")
38+
simple6ProviderExe := e2e.GoBuild("github.com/hashicorp/terraform/internal/provider-simple-v6/main", simple6Provider)
39+
40+
simpleProvider := filepath.Join(tf.WorkDir(), "terraform-provider-simple")
41+
simpleProviderExe := e2e.GoBuild("github.com/hashicorp/terraform/internal/provider-simple/main", simpleProvider)
42+
43+
// Move the provider binaries into a directory that we will point terraform
44+
// to using the -plugin-dir cli flag.
45+
platform := getproviders.CurrentPlatform.String()
46+
hashiDir := "cache/registry.terraform.io/hashicorp/"
47+
if err := os.MkdirAll(tf.Path(hashiDir, "simple6/0.0.1/", platform), os.ModePerm); err != nil {
48+
t.Fatal(err)
49+
}
50+
if err := os.Rename(simple6ProviderExe, tf.Path(hashiDir, "simple6/0.0.1/", platform, "terraform-provider-simple6")); err != nil {
51+
t.Fatal(err)
52+
}
53+
54+
if err := os.MkdirAll(tf.Path(hashiDir, "simple/0.0.1/", platform), os.ModePerm); err != nil {
55+
t.Fatal(err)
56+
}
57+
if err := os.Rename(simpleProviderExe, tf.Path(hashiDir, "simple/0.0.1/", platform, "terraform-provider-simple")); err != nil {
58+
t.Fatal(err)
59+
}
60+
61+
//// INIT
62+
_, stderr, err := tf.Run("init", "-plugin-dir=cache")
63+
if err != nil {
64+
t.Fatalf("unexpected init error: %s\nstderr:\n%s", err, stderr)
65+
}
66+
67+
expectedRawOutput := `{
68+
"format_version": "1.0",
69+
"provider_schemas": {
70+
"registry.terraform.io/hashicorp/simple": {
71+
"provider": {
72+
"version": 0,
73+
"block": {
74+
"description_kind": "plain"
75+
}
76+
},
77+
"resource_schemas": {
78+
"simple_resource": {
79+
"version": 0,
80+
"block": {
81+
"attributes": {
82+
"id": {
83+
"type": "string",
84+
"description_kind": "plain",
85+
"computed": true
86+
},
87+
"value": {
88+
"type": "string",
89+
"description_kind": "plain",
90+
"optional": true
91+
}
92+
},
93+
"description_kind": "plain"
94+
}
95+
}
96+
},
97+
"data_source_schemas": {
98+
"simple_resource": {
99+
"version": 0,
100+
"block": {
101+
"attributes": {
102+
"id": {
103+
"type": "string",
104+
"description_kind": "plain",
105+
"computed": true
106+
},
107+
"value": {
108+
"type": "string",
109+
"description_kind": "plain",
110+
"optional": true
111+
}
112+
},
113+
"description_kind": "plain"
114+
}
115+
}
116+
},
117+
"ephemeral_resource_schemas": {
118+
"simple_resource": {
119+
"version": 0,
120+
"block": {
121+
"attributes": {
122+
"id": {
123+
"type": "string",
124+
"description_kind": "plain",
125+
"computed": true
126+
},
127+
"value": {
128+
"type": "string",
129+
"description_kind": "plain",
130+
"optional": true
131+
}
132+
},
133+
"description_kind": "plain"
134+
}
135+
}
136+
},
137+
"resource_identity_schemas": {
138+
"simple_resource": {
139+
"version": 0,
140+
"attributes": {
141+
"id": {
142+
"type": "string",
143+
"required_for_import": true
144+
}
145+
}
146+
}
147+
}
148+
},
149+
"registry.terraform.io/hashicorp/simple6": {
150+
"provider": {
151+
"version": 0,
152+
"block": {
153+
"description_kind": "plain"
154+
}
155+
},
156+
"resource_schemas": {
157+
"simple_resource": {
158+
"version": 0,
159+
"block": {
160+
"attributes": {
161+
"id": {
162+
"type": "string",
163+
"description_kind": "plain",
164+
"computed": true
165+
},
166+
"value": {
167+
"type": "string",
168+
"description_kind": "plain",
169+
"optional": true
170+
}
171+
},
172+
"description_kind": "plain"
173+
}
174+
}
175+
},
176+
"data_source_schemas": {
177+
"simple_resource": {
178+
"version": 0,
179+
"block": {
180+
"attributes": {
181+
"id": {
182+
"type": "string",
183+
"description_kind": "plain",
184+
"computed": true
185+
},
186+
"value": {
187+
"type": "string",
188+
"description_kind": "plain",
189+
"optional": true
190+
}
191+
},
192+
"description_kind": "plain"
193+
}
194+
}
195+
},
196+
"ephemeral_resource_schemas": {
197+
"simple_resource": {
198+
"version": 0,
199+
"block": {
200+
"attributes": {
201+
"id": {
202+
"type": "string",
203+
"description_kind": "plain",
204+
"computed": true
205+
},
206+
"value": {
207+
"type": "string",
208+
"description_kind": "plain",
209+
"optional": true
210+
}
211+
},
212+
"description_kind": "plain"
213+
}
214+
}
215+
},
216+
"functions": {
217+
"noop": {
218+
"description": "noop takes any single argument and returns the same value",
219+
"return_type": "dynamic",
220+
"parameters": [
221+
{
222+
"name": "noop",
223+
"description": "any value",
224+
"is_nullable": true,
225+
"type": "dynamic"
226+
}
227+
]
228+
}
229+
},
230+
"resource_identity_schemas": {
231+
"simple_resource": {
232+
"version": 0,
233+
"attributes": {
234+
"id": {
235+
"type": "string",
236+
"required_for_import": true
237+
}
238+
}
239+
}
240+
}
241+
}
242+
}
243+
}
244+
`
245+
var expectedOutput bytes.Buffer
246+
err = json.Compact(&expectedOutput, []byte(expectedRawOutput))
247+
if err != nil {
248+
t.Fatal(err)
249+
}
250+
251+
stdout, stderr, err := tf.Run("providers", "schema", "-json")
252+
if err != nil {
253+
t.Fatalf("unexpected error: %s\n%s", err, stderr)
254+
}
255+
256+
var output bytes.Buffer
257+
err = json.Compact(&output, []byte(stdout))
258+
if err != nil {
259+
t.Fatal(err)
260+
}
261+
262+
if diff := cmp.Diff(expectedOutput.String(), output.String()); diff != "" {
263+
t.Fatalf("unexpected schema: %s\n", diff)
264+
}
265+
}

0 commit comments

Comments
 (0)