Skip to content

Commit 2e2345a

Browse files
Bump github.com/hashicorp/terraform-plugin-framework from 0.14.0 to 0.15.0 (hashicorp#196)
* Bump github.com/hashicorp/terraform-plugin-framework Bumps [github.com/hashicorp/terraform-plugin-framework](https://github.com/hashicorp/terraform-plugin-framework) from 0.14.0 to 0.15.0. - [Release notes](https://github.com/hashicorp/terraform-plugin-framework/releases) - [Changelog](https://github.com/hashicorp/terraform-plugin-framework/blob/main/CHANGELOG.md) - [Commits](hashicorp/terraform-plugin-framework@v0.14.0...v0.15.0) --- updated-dependencies: - dependency-name: github.com/hashicorp/terraform-plugin-framework dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * all: Handle [email protected] deprecations * Simplifying by using types.MapValueFrom Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Benjamin Bennett <[email protected]>
1 parent 09a48c1 commit 2e2345a

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.18
44

55
require (
66
github.com/hashicorp/terraform-plugin-docs v0.13.0
7-
github.com/hashicorp/terraform-plugin-framework v0.14.0
7+
github.com/hashicorp/terraform-plugin-framework v0.15.0
88
github.com/hashicorp/terraform-plugin-framework-validators v0.5.0
99
github.com/hashicorp/terraform-plugin-go v0.14.0
1010
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e
139139
github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZbIYnAIkEyqP2pNSckM=
140140
github.com/hashicorp/terraform-plugin-docs v0.13.0 h1:6e+VIWsVGb6jYJewfzq2ok2smPzZrt1Wlm9koLeKazY=
141141
github.com/hashicorp/terraform-plugin-docs v0.13.0/go.mod h1:W0oCmHAjIlTHBbvtppWHe8fLfZ2BznQbuv8+UD8OucQ=
142-
github.com/hashicorp/terraform-plugin-framework v0.14.0 h1:Mwj55u+Jc/QGM6fLBPCe1P+ZF3cuYs6wbCdB15lx/Dg=
143-
github.com/hashicorp/terraform-plugin-framework v0.14.0/go.mod h1:wcZdk4+Uef6Ng+BiBJjGAcIPlIs5bhlEV/TA1k6Xkq8=
142+
github.com/hashicorp/terraform-plugin-framework v0.15.0 h1:6f4UY2yfp5UsSX9JhUA6RSptjd+ojStBGWA4jrPhB6Q=
143+
github.com/hashicorp/terraform-plugin-framework v0.15.0/go.mod h1:wcZdk4+Uef6Ng+BiBJjGAcIPlIs5bhlEV/TA1k6Xkq8=
144144
github.com/hashicorp/terraform-plugin-framework-validators v0.5.0 h1:eD79idhnJOBajkUMEbm0c8dOyOb/F49STbUEVojT6F4=
145145
github.com/hashicorp/terraform-plugin-framework-validators v0.5.0/go.mod h1:NfGgclDM3FZqvNVppPKE2aHI1JAyT002ypPRya7ch3I=
146146
github.com/hashicorp/terraform-plugin-go v0.14.0 h1:ttnSlS8bz3ZPYbMb84DpcPhY4F5DsQtcAS7cHo8uvP4=

internal/provider/data_source_http.go

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ import (
55
"crypto/tls"
66
"crypto/x509"
77
"fmt"
8-
"github.com/hashicorp/terraform-plugin-framework-validators/schemavalidator"
9-
"github.com/hashicorp/terraform-plugin-framework/path"
108
"io/ioutil"
119
"mime"
1210
"net/http"
1311
"regexp"
1412
"strings"
1513

14+
"github.com/hashicorp/terraform-plugin-framework-validators/schemavalidator"
15+
"github.com/hashicorp/terraform-plugin-framework/path"
16+
1617
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
1718
"github.com/hashicorp/terraform-plugin-framework/datasource"
1819
"github.com/hashicorp/terraform-plugin-framework/diag"
@@ -150,10 +151,10 @@ func (d *httpDataSource) Read(ctx context.Context, req datasource.ReadRequest, r
150151
return
151152
}
152153

153-
url := model.URL.Value
154-
method := model.Method.Value
154+
url := model.URL.ValueString()
155+
method := model.Method.ValueString()
155156
requestHeaders := model.RequestHeaders
156-
requestBody := strings.NewReader(model.RequestBody.Value)
157+
requestBody := strings.NewReader(model.RequestBody.ValueString())
157158

158159
if method == "" {
159160
method = "GET"
@@ -166,13 +167,13 @@ func (d *httpDataSource) Read(ctx context.Context, req datasource.ReadRequest, r
166167
}
167168

168169
if !model.Insecure.IsNull() {
169-
tr.TLSClientConfig.InsecureSkipVerify = model.Insecure.Value
170+
tr.TLSClientConfig.InsecureSkipVerify = model.Insecure.ValueBool()
170171
}
171172

172173
// Use `ca_cert_pem` cert pool
173174
if !caCertificate.IsNull() {
174175
caCertPool := x509.NewCertPool()
175-
if ok := caCertPool.AppendCertsFromPEM([]byte(caCertificate.Value)); !ok {
176+
if ok := caCertPool.AppendCertsFromPEM([]byte(caCertificate.ValueString())); !ok {
176177
resp.Diagnostics.AddError(
177178
"Error configuring TLS client",
178179
"Error tls: Can't add the CA certificate to certificate pool. Only PEM encoded certificates are supported.",
@@ -196,7 +197,7 @@ func (d *httpDataSource) Read(ctx context.Context, req datasource.ReadRequest, r
196197
return
197198
}
198199

199-
for name, value := range requestHeaders.Elems {
200+
for name, value := range requestHeaders.Elements() {
200201
var header string
201202
diags = tfsdk.ValueAs(ctx, value, &header)
202203
resp.Diagnostics.Append(diags...)
@@ -244,19 +245,17 @@ func (d *httpDataSource) Read(ctx context.Context, req datasource.ReadRequest, r
244245
responseHeaders[k] = strings.Join(v, ", ")
245246
}
246247

247-
respHeadersState := types.Map{}
248-
249-
diags = tfsdk.ValueFrom(ctx, responseHeaders, types.Map{ElemType: types.StringType}.Type(ctx), &respHeadersState)
248+
respHeadersState, diags := types.MapValueFrom(ctx, types.StringType, responseHeaders)
250249
resp.Diagnostics.Append(diags...)
251250
if resp.Diagnostics.HasError() {
252251
return
253252
}
254253

255-
model.ID = types.String{Value: url}
254+
model.ID = types.StringValue(url)
256255
model.ResponseHeaders = respHeadersState
257-
model.ResponseBody = types.String{Value: responseBody}
258-
model.Body = types.String{Value: responseBody}
259-
model.StatusCode = types.Int64{Value: int64(response.StatusCode)}
256+
model.ResponseBody = types.StringValue(responseBody)
257+
model.Body = types.StringValue(responseBody)
258+
model.StatusCode = types.Int64Value(int64(response.StatusCode))
260259

261260
diags = resp.State.Set(ctx, model)
262261
resp.Diagnostics.Append(diags...)

0 commit comments

Comments
 (0)