From 6309dcca3c64219b38fa007e51afc03d1a0831ea Mon Sep 17 00:00:00 2001 From: Douglas Parsons Date: Tue, 16 Aug 2022 08:47:07 +0100 Subject: [PATCH] Upgrade Go + Dependency versions to latest Release notes here: https://github.com/hashicorp/terraform-plugin-framework/releases This is mostly a shuffling of package names for the terraform-plugin-framework. I've renamed the provider struct to vercelProvider just so the name doesn't clash with the new terraform-plugin-framework/provider package. I've also bumped the minimum go version to 1.19, as the latest tf-plugin is >1.18. I've had to disable the `tfproviderlint` tool to do this. It looks poorly maintained and still doesn't support Go1.18+ syntax. --- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 4 +- Taskfile.yml | 19 +++++----- client/project_update.go | 2 +- client/request.go | 4 +- go.mod | 28 +++++++------- go.sum | 28 ++++++++++++++ vercel/data_source_alias.go | 17 +++++---- vercel/data_source_file.go | 10 +++-- vercel/data_source_project.go | 19 +++++----- vercel/data_source_project_directory.go | 10 +++-- vercel/provider.go | 19 +++++----- vercel/resource_alias.go | 22 ++++++----- vercel/resource_deployment.go | 50 +++++++++++++------------ vercel/resource_dns_record.go | 26 +++++++------ vercel/resource_project.go | 32 ++++++++-------- vercel/resource_project_domain.go | 26 +++++++------ vercel/validator_framework.go | 4 +- 18 files changed, 184 insertions(+), 138 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f665d83b..3639d32f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,7 +25,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: "1.17" + go-version: "1.19" - name: Import GPG key id: import_gpg uses: crazy-max/ghaction-import-gpg@v5 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 27f22d3d..e52607bc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: "1.17" + go-version: "1.19" id: go - name: Install Task uses: arduino/setup-task@v1 @@ -58,7 +58,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: "1.17" + go-version: "1.19" id: go - uses: hashicorp/setup-terraform@v1 with: diff --git a/Taskfile.yml b/Taskfile.yml index 52f5f95b..1a3b249d 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -43,25 +43,26 @@ tasks: install-staticcheck: desc: "Install the staticheck tool" cmds: - - go install honnef.co/go/tools/cmd/staticcheck@2021.1 + - go install honnef.co/go/tools/cmd/staticcheck@2022.1.3 status: - which staticcheck - install-providerlint: - desc: "Install tfproviderlint tool" - cmds: - - go install github.com/bflad/tfproviderlint/cmd/tfproviderlint@latest - status: - - which tfproviderlint + # Temporarily disable tfproviderlint as it doesn't support go 1.18+ syntax + # install-providerlint: + # desc: "Install tfproviderlint tool" + # cmds: + # - go install github.com/bflad/tfproviderlint/cmd/tfproviderlint@latest + # status: + # - which tfproviderlint lint: desc: "Run linters against the provider" deps: - install-staticcheck - - install-providerlint + # - install-providerlint cmds: - staticcheck -tags it ./... - - tfproviderlint -R018=false -R009=false ./... + # - tfproviderlint -R018=false -R009=false ./... - cmd: | export BADFMT=$(gofmt -s -l .) test -z "$BADFMT" || (echo -e "invalid gofmt: $BADFMT"; exit 1) diff --git a/client/project_update.go b/client/project_update.go index 5f8c1718..a0da6a4c 100644 --- a/client/project_update.go +++ b/client/project_update.go @@ -13,7 +13,7 @@ import ( // note that the values are all pointers, with many containing `omitempty` for serialisation. // This is because the Vercel API behaves in the following manner: // - a provided field will be updated -// - setting the field to an empty value (e.g. '') will remove the setting for that field. +// - setting the field to an empty value (e.g. ”) will remove the setting for that field. // - omitting the value entirely from the request will _not_ update the field. type UpdateProjectRequest struct { BuildCommand *string `json:"buildCommand"` diff --git a/client/request.go b/client/request.go index f341aec9..88dea93d 100644 --- a/client/request.go +++ b/client/request.go @@ -3,7 +3,7 @@ package client import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" ) @@ -38,7 +38,7 @@ func (c *Client) doRequest(req *http.Request, v interface{}) error { } defer resp.Body.Close() - responseBody, err := ioutil.ReadAll(resp.Body) + responseBody, err := io.ReadAll(resp.Body) if err != nil { return fmt.Errorf("error reading response body: %w", err) } diff --git a/go.mod b/go.mod index a4b00f53..750b0245 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,11 @@ module github.com/vercel/terraform-provider-vercel -go 1.17 +go 1.19 require ( - github.com/hashicorp/terraform-plugin-framework v0.8.0 - github.com/hashicorp/terraform-plugin-go v0.9.0 - github.com/hashicorp/terraform-plugin-log v0.4.0 + github.com/hashicorp/terraform-plugin-framework v0.11.1 + github.com/hashicorp/terraform-plugin-go v0.14.0 + github.com/hashicorp/terraform-plugin-log v0.7.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1 github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 ) @@ -22,7 +22,7 @@ require ( github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect - github.com/hashicorp/go-hclog v1.2.0 // indirect + github.com/hashicorp/go-hclog v1.2.2 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-plugin v1.4.4 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect @@ -32,11 +32,11 @@ require ( github.com/hashicorp/logutils v1.0.0 // indirect github.com/hashicorp/terraform-exec v0.15.0 // indirect github.com/hashicorp/terraform-json v0.13.0 // indirect - github.com/hashicorp/terraform-registry-address v0.0.0-20220422185603-6772e136ec01 // indirect + github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c // indirect github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect - github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87 // indirect - github.com/mattn/go-colorable v0.1.12 // indirect - github.com/mattn/go-isatty v0.0.14 // indirect + github.com/hashicorp/yamux v0.1.1 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.16 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect @@ -48,11 +48,11 @@ require ( github.com/vmihailenco/tagparser v0.1.2 // indirect github.com/zclconf/go-cty v1.10.0 // indirect golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect - golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect + golang.org/x/net v0.0.0-20220812174116-3211cb980234 // indirect + golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect golang.org/x/text v0.3.7 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3 // indirect - google.golang.org/grpc v1.46.0 // indirect - google.golang.org/protobuf v1.28.0 // indirect + google.golang.org/genproto v0.0.0-20220815135757-37a418bb8959 // indirect + google.golang.org/grpc v1.48.0 // indirect + google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/go.sum b/go.sum index b8dcf93c..eba4d58d 100644 --- a/go.sum +++ b/go.sum @@ -190,6 +190,8 @@ github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39 github.com/hashicorp/go-hclog v0.16.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-hclog v1.2.0 h1:La19f8d7WIlm4ogzNHB0JGqs5AUDAZ2UfCY4sJXcJdM= github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-hclog v1.2.2 h1:ihRI7YFwcZdiSD7SIenIhHfQH3OuDvWerAUBZbeQS3M= +github.com/hashicorp/go-hclog v1.2.2/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= @@ -224,24 +226,34 @@ github.com/hashicorp/terraform-json v0.13.0 h1:Li9L+lKD1FO5RVFRM1mMMIBDoUHslOniy github.com/hashicorp/terraform-json v0.13.0/go.mod h1:y5OdLBCT+rxbwnpxZs9kGL7R9ExU76+cpdY8zHwoazk= github.com/hashicorp/terraform-plugin-framework v0.8.0 h1:2nxk+5qAKlGWOrpWZbAZNkO+AoC87l4+9d/rjtQd6Wo= github.com/hashicorp/terraform-plugin-framework v0.8.0/go.mod h1:jUhqrbeI48gAleP8LXzg9jtRH07EAcpwEGQlYmKNIVg= +github.com/hashicorp/terraform-plugin-framework v0.11.1 h1:rq8f+TLDO4tJu+n9mMYlDrcRoIdrg0gTUvV2Jr0Ya24= +github.com/hashicorp/terraform-plugin-framework v0.11.1/go.mod h1:GENReHOz6GEt8Jk3UN94vk8BdC6irEHFgN3Z9HPhPUU= github.com/hashicorp/terraform-plugin-go v0.5.0/go.mod h1:PAVN26PNGpkkmsvva1qfriae5Arky3xl3NfzKa8XFVM= github.com/hashicorp/terraform-plugin-go v0.9.0 h1:FvLY/3z4SNVatPZdoFcyrlNbCar+WyyOTv5X4Tp+WZc= github.com/hashicorp/terraform-plugin-go v0.9.0/go.mod h1:EawBkgjBWNf7jiKnVoyDyF39OSV+u6KUX+Y73EPj3oM= +github.com/hashicorp/terraform-plugin-go v0.14.0 h1:ttnSlS8bz3ZPYbMb84DpcPhY4F5DsQtcAS7cHo8uvP4= +github.com/hashicorp/terraform-plugin-go v0.14.0/go.mod h1:2nNCBeRLaenyQEi78xrGrs9hMbulveqG/zDMQSvVJTE= github.com/hashicorp/terraform-plugin-log v0.2.0/go.mod h1:E1kJmapEHzqu1x6M++gjvhzM2yMQNXPVWZRCB8sgYjg= github.com/hashicorp/terraform-plugin-log v0.3.0/go.mod h1:EjueSP/HjlyFAsDqt+okpCPjkT4NDynAe32AeDC4vps= github.com/hashicorp/terraform-plugin-log v0.4.0 h1:F3eVnm8r2EfQCe2k9blPIiF/r2TT01SHijXnS7bujvc= github.com/hashicorp/terraform-plugin-log v0.4.0/go.mod h1:9KclxdunFownr4pIm1jdmwKRmE4d6HVG2c9XDq47rpg= +github.com/hashicorp/terraform-plugin-log v0.7.0 h1:SDxJUyT8TwN4l5b5/VkiTIaQgY6R+Y2BQ0sRZftGKQs= +github.com/hashicorp/terraform-plugin-log v0.7.0/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4= github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1 h1:B9AocC+dxrCqcf4vVhztIkSkt3gpRjUkEka8AmZWGlQ= github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1/go.mod h1:FjM9DXWfP0w/AeOtJoSKHBZ01LqmaO6uP4bXhv3fekw= github.com/hashicorp/terraform-registry-address v0.0.0-20210412075316-9b2996cce896/go.mod h1:bzBPnUIkI0RxauU8Dqo+2KrZZ28Cf48s8V6IHt3p4co= github.com/hashicorp/terraform-registry-address v0.0.0-20220422185603-6772e136ec01 h1:HgJRxDmThXP6Jdjv2pHufKfESG23Y3x8VtXgmtMDsq8= github.com/hashicorp/terraform-registry-address v0.0.0-20220422185603-6772e136ec01/go.mod h1:bdLC+qQlJIBHKbCMA6GipcuaKjmjcvZlnVdpU583z3Y= +github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c h1:D8aRO6+mTqHfLsK/BC3j5OAoogv1WLRWzY1AaTo3rBg= +github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c/go.mod h1:Wn3Na71knbXc1G8Lh+yu/dQWWJeFQEpDeJMtWMtlmNI= github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0= github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg= github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87 h1:xixZ2bWeofWV68J+x6AzmKuVM/JWCQwkWm6GW/MUR6I= github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= +github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= @@ -280,6 +292,8 @@ github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= @@ -287,6 +301,8 @@ github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcME github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mitchellh/cli v1.1.2/go.mod h1:6iaV0fGdElS6dPBx0EApTxHrcWvmJphyh2n8YBLPPZ4= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= @@ -341,6 +357,7 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/ulikunitz/xz v0.5.8 h1:ERv8V6GKqVi23rgu5cj9pVfVzJbOqAY2Ntl88O6c2nQ= github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= @@ -450,6 +467,8 @@ golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5o golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220812174116-3211cb980234 h1:RDqmgfe7SvlMWoqC3xwQ2blLO3fcWcxMa3eBLRdRW7E= +golang.org/x/net v0.0.0-20220812174116-3211cb980234/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -508,6 +527,8 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 h1:nonptSpoQ4vQjyraW20DXPAglgQfVnM9ZC6MmNLMR60= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab h1:2QkjZIsXupsJbJIdSjjUOgWK3aEtzyuh2mPt3l/CkeU= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -621,6 +642,8 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200711021454-869866162049/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3 h1:q1kiSVscqoDeqTF27eQ2NnLLDmqF0I373qQNXYMy0fo= google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= +google.golang.org/genproto v0.0.0-20220815135757-37a418bb8959 h1:hw4Y42zL1VyVKxPgRHHh191fpVBGV8sNVmcow5Z8VXY= +google.golang.org/genproto v0.0.0-20220815135757-37a418bb8959/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -639,6 +662,8 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8= google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.48.0 h1:rQOsyJ/8+ufEDJd/Gdsz7HG220Mh9HAhFHRGnIjda0w= +google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0/go.mod h1:DNq5QpG7LJqD2AamLZ7zvKE0DEpVl2BSEVjFycAAjRY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -655,6 +680,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -671,6 +698,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/vercel/data_source_alias.go b/vercel/data_source_alias.go index 791d862e..64e3d772 100644 --- a/vercel/data_source_alias.go +++ b/vercel/data_source_alias.go @@ -4,7 +4,9 @@ import ( "context" "fmt" + "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/provider" "github.com/hashicorp/terraform-plugin-framework/tfsdk" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" @@ -21,10 +23,9 @@ Provides information about an existing Alias resource. An Alias allows a ` + "`vercel_deployment` to be accessed through a different URL.", Attributes: map[string]tfsdk.Attribute{ "team_id": { - Optional: true, - Type: types.StringType, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, - Description: "The ID of the team the Alias and Deployment exist under.", + Optional: true, + Type: types.StringType, + Description: "The ID of the team the Alias and Deployment exist under.", }, "alias": { Required: true, @@ -45,20 +46,20 @@ An Alias allows a ` + "`vercel_deployment` to be accessed through a different UR } // NewDataSource instantiates a new DataSource of this DataSourceType. -func (r dataSourceAliasType) NewDataSource(ctx context.Context, p tfsdk.Provider) (tfsdk.DataSource, diag.Diagnostics) { +func (r dataSourceAliasType) NewDataSource(ctx context.Context, p provider.Provider) (datasource.DataSource, diag.Diagnostics) { return dataSourceAlias{ - p: *(p.(*provider)), + p: *(p.(*vercelProvider)), }, nil } type dataSourceAlias struct { - p provider + p vercelProvider } // Read will read the alias information by requesting it from the Vercel API, and will update terraform // with this information. // It is called by the provider whenever data source values should be read to update state. -func (r dataSourceAlias) Read(ctx context.Context, req tfsdk.ReadDataSourceRequest, resp *tfsdk.ReadDataSourceResponse) { +func (r dataSourceAlias) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { var config Alias diags := req.Config.Get(ctx, &config) resp.Diagnostics.Append(diags...) diff --git a/vercel/data_source_file.go b/vercel/data_source_file.go index 2713db17..8b68c4f5 100644 --- a/vercel/data_source_file.go +++ b/vercel/data_source_file.go @@ -8,7 +8,9 @@ import ( "fmt" "os" + "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/provider" "github.com/hashicorp/terraform-plugin-framework/tfsdk" "github.com/hashicorp/terraform-plugin-framework/types" ) @@ -54,14 +56,14 @@ This will read a single file, providing metadata for use with a ` + "`vercel_dep } // NewDataSource instantiates a new DataSource of this DataSourceType. -func (r dataSourceFileType) NewDataSource(ctx context.Context, p tfsdk.Provider) (tfsdk.DataSource, diag.Diagnostics) { +func (r dataSourceFileType) NewDataSource(ctx context.Context, p provider.Provider) (datasource.DataSource, diag.Diagnostics) { return dataSourceFile{ - p: *(p.(*provider)), + p: *(p.(*vercelProvider)), }, nil } type dataSourceFile struct { - p provider + p vercelProvider } // FileData represents the information terraform knows about a File data source @@ -73,7 +75,7 @@ type FileData struct { // Read will read a file from the filesytem and provide terraform with information about it. // It is called by the provider whenever data source values should be read to update state. -func (r dataSourceFile) Read(ctx context.Context, req tfsdk.ReadDataSourceRequest, resp *tfsdk.ReadDataSourceResponse) { +func (r dataSourceFile) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { var config FileData diags := req.Config.Get(ctx, &config) resp.Diagnostics.Append(diags...) diff --git a/vercel/data_source_project.go b/vercel/data_source_project.go index d789c7cc..b32739fb 100644 --- a/vercel/data_source_project.go +++ b/vercel/data_source_project.go @@ -5,7 +5,9 @@ import ( "fmt" "regexp" + "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/provider" "github.com/hashicorp/terraform-plugin-framework/tfsdk" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" @@ -25,10 +27,9 @@ For more detailed information, please see the [Vercel documentation](https://ver `, Attributes: map[string]tfsdk.Attribute{ "team_id": { - Optional: true, - Type: types.StringType, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, - Description: "The team ID the project exists beneath.", + Optional: true, + Type: types.StringType, + Description: "The team ID the project exists beneath.", }, "name": { Required: true, @@ -93,7 +94,7 @@ For more detailed information, please see the [Vercel documentation](https://ver Type: types.StringType, Computed: true, }, - }, tfsdk.SetNestedAttributesOptions{}), + }), }, "framework": { Computed: true, @@ -148,20 +149,20 @@ For more detailed information, please see the [Vercel documentation](https://ver } // NewDataSource instantiates a new DataSource of this DataSourceType. -func (r dataSourceProjectType) NewDataSource(ctx context.Context, p tfsdk.Provider) (tfsdk.DataSource, diag.Diagnostics) { +func (r dataSourceProjectType) NewDataSource(ctx context.Context, p provider.Provider) (datasource.DataSource, diag.Diagnostics) { return dataSourceProject{ - p: *(p.(*provider)), + p: *(p.(*vercelProvider)), }, nil } type dataSourceProject struct { - p provider + p vercelProvider } // Read will read project information by requesting it from the Vercel API, and will update terraform // with this information. // It is called by the provider whenever data source values should be read to update state. -func (r dataSourceProject) Read(ctx context.Context, req tfsdk.ReadDataSourceRequest, resp *tfsdk.ReadDataSourceResponse) { +func (r dataSourceProject) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { var config Project diags := req.Config.Get(ctx, &config) resp.Diagnostics.Append(diags...) diff --git a/vercel/data_source_project_directory.go b/vercel/data_source_project_directory.go index 2b8018c6..9a5fbbdb 100644 --- a/vercel/data_source_project_directory.go +++ b/vercel/data_source_project_directory.go @@ -7,7 +7,9 @@ import ( "fmt" "os" + "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/provider" "github.com/hashicorp/terraform-plugin-framework/tfsdk" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/vercel/terraform-provider-vercel/glob" @@ -47,14 +49,14 @@ This will recursively read files, providing metadata for use with a ` + "`vercel } // NewDataSource instantiates a new DataSource of this DataSourceType. -func (r dataSourceProjectDirectoryType) NewDataSource(ctx context.Context, p tfsdk.Provider) (tfsdk.DataSource, diag.Diagnostics) { +func (r dataSourceProjectDirectoryType) NewDataSource(ctx context.Context, p provider.Provider) (datasource.DataSource, diag.Diagnostics) { return dataSourceProjectDirectory{ - p: *(p.(*provider)), + p: *(p.(*vercelProvider)), }, nil } type dataSourceProjectDirectory struct { - p provider + p vercelProvider } // ProjectDirectoryData represents the information terraform knows about a project directory data source @@ -67,7 +69,7 @@ type ProjectDirectoryData struct { // Read will recursively scan a directory looking for any files that do not match a .vercelignore file (if a // .vercelignore is present). Metadata about all these files will then be made available to terraform. // It is called by the provider whenever data source values should be read to update state. -func (r dataSourceProjectDirectory) Read(ctx context.Context, req tfsdk.ReadDataSourceRequest, resp *tfsdk.ReadDataSourceResponse) { +func (r dataSourceProjectDirectory) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { var config ProjectDirectoryData diags := req.Config.Get(ctx, &config) resp.Diagnostics.Append(diags...) diff --git a/vercel/provider.go b/vercel/provider.go index eea47139..3dfb3e7e 100644 --- a/vercel/provider.go +++ b/vercel/provider.go @@ -6,23 +6,24 @@ import ( "regexp" "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/provider" "github.com/hashicorp/terraform-plugin-framework/tfsdk" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/vercel/terraform-provider-vercel/client" ) -type provider struct { +type vercelProvider struct { configured bool client *client.Client } // New instantiates a new instance of a vercel terraform provider. -func New() tfsdk.Provider { - return &provider{} +func New() provider.Provider { + return &vercelProvider{} } // GetSchema returns the schema information for the provider configuration itself. -func (p *provider) GetSchema(_ context.Context) (tfsdk.Schema, diag.Diagnostics) { +func (p *vercelProvider) GetSchema(_ context.Context) (tfsdk.Schema, diag.Diagnostics) { return tfsdk.Schema{ Description: ` The Vercel provider is used to interact with resources supported by Vercel. @@ -42,8 +43,8 @@ Use the navigation to the left to read about the available resources. } // GetResources shows the available resources for the vercel provider -func (p *provider) GetResources(_ context.Context) (map[string]tfsdk.ResourceType, diag.Diagnostics) { - return map[string]tfsdk.ResourceType{ +func (p *vercelProvider) GetResources(_ context.Context) (map[string]provider.ResourceType, diag.Diagnostics) { + return map[string]provider.ResourceType{ "vercel_alias": resourceAliasType{}, "vercel_deployment": resourceDeploymentType{}, "vercel_project": resourceProjectType{}, @@ -53,8 +54,8 @@ func (p *provider) GetResources(_ context.Context) (map[string]tfsdk.ResourceTyp } // GetDataSources shows the available data sources for the vercel provider -func (p *provider) GetDataSources(_ context.Context) (map[string]tfsdk.DataSourceType, diag.Diagnostics) { - return map[string]tfsdk.DataSourceType{ +func (p *vercelProvider) GetDataSources(_ context.Context) (map[string]provider.DataSourceType, diag.Diagnostics) { + return map[string]provider.DataSourceType{ "vercel_file": dataSourceFileType{}, "vercel_project": dataSourceProjectType{}, "vercel_project_directory": dataSourceProjectDirectoryType{}, @@ -72,7 +73,7 @@ var apiTokenRe = regexp.MustCompile("[0-9a-zA-Z]{24}") // Configure takes a provider and applies any configuration. In the context of Vercel // this allows us to set up an API token. -func (p *provider) Configure(ctx context.Context, req tfsdk.ConfigureProviderRequest, resp *tfsdk.ConfigureProviderResponse) { +func (p *vercelProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) { var config providerData diags := req.Config.Get(ctx, &config) resp.Diagnostics.Append(diags...) diff --git a/vercel/resource_alias.go b/vercel/resource_alias.go index 74ed357e..482d23c1 100644 --- a/vercel/resource_alias.go +++ b/vercel/resource_alias.go @@ -5,6 +5,8 @@ import ( "fmt" "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/provider" + "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/tfsdk" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" @@ -24,19 +26,19 @@ An Alias allows a ` + "`vercel_deployment` to be accessed through a different UR "alias": { Description: "The Alias we want to assign to the deployment defined in the URL.", Required: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Type: types.StringType, }, "deployment_id": { Description: "The id of the Deployment the Alias should be associated with.", Required: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Type: types.StringType, }, "team_id": { Optional: true, Description: "The ID of the team the Alias and Deployment exist under.", - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Type: types.StringType, }, "id": { @@ -48,19 +50,19 @@ An Alias allows a ` + "`vercel_deployment` to be accessed through a different UR } // NewResource instantiates a new Resource of this ResourceType. -func (r resourceAliasType) NewResource(_ context.Context, p tfsdk.Provider) (tfsdk.Resource, diag.Diagnostics) { +func (r resourceAliasType) NewResource(_ context.Context, p provider.Provider) (resource.Resource, diag.Diagnostics) { return resourceAlias{ - p: *(p.(*provider)), + p: *(p.(*vercelProvider)), }, nil } type resourceAlias struct { - p provider + p vercelProvider } // Create will create an alias within Vercel. // This is called automatically by the provider when a new resource should be created. -func (r resourceAlias) Create(ctx context.Context, req tfsdk.CreateResourceRequest, resp *tfsdk.CreateResourceResponse) { +func (r resourceAlias) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { if !r.p.configured { resp.Diagnostics.AddError( "Provider not configured", @@ -103,7 +105,7 @@ func (r resourceAlias) Create(ctx context.Context, req tfsdk.CreateResourceReque // Read will read alias information by requesting it from the Vercel API, and will update terraform // with this information. -func (r resourceAlias) Read(ctx context.Context, req tfsdk.ReadResourceRequest, resp *tfsdk.ReadResourceResponse) { +func (r resourceAlias) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { var state Alias diags := req.State.Get(ctx, &state) resp.Diagnostics.Append(diags...) @@ -142,7 +144,7 @@ func (r resourceAlias) Read(ctx context.Context, req tfsdk.ReadResourceRequest, } // Update updates the Alias state. -func (r resourceAlias) Update(ctx context.Context, req tfsdk.UpdateResourceRequest, resp *tfsdk.UpdateResourceResponse) { +func (r resourceAlias) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { var plan Alias diags := req.Plan.Get(ctx, &plan) resp.Diagnostics.Append(diags...) @@ -164,7 +166,7 @@ func (r resourceAlias) Update(ctx context.Context, req tfsdk.UpdateResourceReque } // Delete deletes an Alias. -func (r resourceAlias) Delete(ctx context.Context, req tfsdk.DeleteResourceRequest, resp *tfsdk.DeleteResourceResponse) { +func (r resourceAlias) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { var state Alias diags := req.State.Get(ctx, &state) resp.Diagnostics.Append(diags...) diff --git a/vercel/resource_deployment.go b/vercel/resource_deployment.go index 855b298d..c01b6d77 100644 --- a/vercel/resource_deployment.go +++ b/vercel/resource_deployment.go @@ -7,6 +7,8 @@ import ( "os" "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/provider" + "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/tfsdk" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" @@ -37,7 +39,7 @@ terraform to your Deployment. "domains": { Description: "A list of all the domains (default domains, staging domains and production domains) that were assigned upon deployment creation.", Computed: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.UseStateForUnknown()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.UseStateForUnknown()}, Type: types.ListType{ ElemType: types.StringType, }, @@ -45,7 +47,7 @@ terraform to your Deployment. "environment": { Description: "A map of environment variable names to values. These are specific to a Deployment, and can also be configured on the `vercel_project` resource.", Optional: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Type: types.MapType{ ElemType: types.StringType, }, @@ -53,43 +55,43 @@ terraform to your Deployment. "team_id": { Description: "The team ID to add the deployment to.", Optional: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Type: types.StringType, }, "project_id": { Description: "The project ID to add the deployment to.", Required: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Type: types.StringType, }, "id": { Computed: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.UseStateForUnknown()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.UseStateForUnknown()}, Type: types.StringType, }, "path_prefix": { Description: "If specified then the `path_prefix` will be stripped from the start of file paths as they are uploaded to Vercel. If this is omitted, then any leading `../`s will be stripped.", Optional: true, Type: types.StringType, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, }, "url": { Description: "A unique URL that is automatically generated for a deployment.", Computed: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.UseStateForUnknown()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.UseStateForUnknown()}, Type: types.StringType, }, "production": { Description: "true if the deployment is a production deployment, meaning production aliases will be assigned.", Optional: true, Computed: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Type: types.BoolType, }, "files": { Description: "A map of files to be uploaded for the deployment. This should be provided by a `vercel_project_directory` or `vercel_file` data source. Required if `git_source` is not set.", Optional: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Type: types.MapType{ ElemType: types.StringType, }, @@ -100,23 +102,23 @@ terraform to your Deployment. "ref": { Description: "The branch or commit hash that should be deployed. Note this will only work if the project is configured to use a Git repository. Required if `ref` is not set.", Optional: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Type: types.StringType, }, "project_settings": { Description: "Project settings that will be applied to the deployment.", Optional: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Attributes: tfsdk.SingleNestedAttributes(map[string]tfsdk.Attribute{ "build_command": { Optional: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Type: types.StringType, Description: "The build command for this deployment. If omitted, this value will be taken from the project or automatically detected.", }, "framework": { Optional: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Type: types.StringType, Description: "The framework that is being used for this deployment. If omitted, no framework is selected.", Validators: []tfsdk.AttributeValidator{ @@ -125,19 +127,19 @@ terraform to your Deployment. }, "install_command": { Optional: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Type: types.StringType, Description: "The install command for this deployment. If omitted, this value will be taken from the project or automatically detected.", }, "output_directory": { Optional: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Type: types.StringType, Description: "The output directory of the deployment. If omitted, this value will be taken from the project or automatically detected.", }, "root_directory": { Optional: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Type: types.StringType, Description: "The name of a directory or relative path to the source code of your project. When null is used it will default to the project root.", }, @@ -153,18 +155,18 @@ terraform to your Deployment. } // NewResource instantiates a new Resource of this ResourceType. -func (r resourceDeploymentType) NewResource(_ context.Context, p tfsdk.Provider) (tfsdk.Resource, diag.Diagnostics) { +func (r resourceDeploymentType) NewResource(_ context.Context, p provider.Provider) (resource.Resource, diag.Diagnostics) { return resourceDeployment{ - p: *(p.(*provider)), + p: *(p.(*vercelProvider)), }, nil } type resourceDeployment struct { - p provider + p vercelProvider } // ValidateConfig allows additional validation (specifically cross-field validation) to be added. -func (r resourceDeployment) ValidateConfig(ctx context.Context, req tfsdk.ValidateResourceConfigRequest, resp *tfsdk.ValidateResourceConfigResponse) { +func (r resourceDeployment) ValidateConfig(ctx context.Context, req resource.ValidateConfigRequest, resp *resource.ValidateConfigResponse) { var config Deployment diags := req.Config.Get(ctx, &config) resp.Diagnostics.Append(diags...) @@ -189,7 +191,7 @@ func (r resourceDeployment) ValidateConfig(ctx context.Context, req tfsdk.Valida // Create will create a deployment within Vercel. This is done by first attempting to trigger a deployment, seeing what // files are required, uploading those files, and then attempting to create a deployment again. // This is called automatically by the provider when a new resource should be created. -func (r resourceDeployment) Create(ctx context.Context, req tfsdk.CreateResourceRequest, resp *tfsdk.CreateResourceResponse) { +func (r resourceDeployment) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { if !r.p.configured { resp.Diagnostics.AddError( "Provider not configured", @@ -323,7 +325,7 @@ func (r resourceDeployment) Create(ctx context.Context, req tfsdk.CreateResource // Read will read a file from the filesytem and provide terraform with information about it. // It is called by the provider whenever data source values should be read to update state. -func (r resourceDeployment) Read(ctx context.Context, req tfsdk.ReadResourceRequest, resp *tfsdk.ReadResourceResponse) { +func (r resourceDeployment) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { var state Deployment diags := req.State.Get(ctx, &state) resp.Diagnostics.Append(diags...) @@ -364,7 +366,7 @@ func (r resourceDeployment) Read(ctx context.Context, req tfsdk.ReadResourceRequ // Update updates the deployment state. // Note that only the `delete_on_destroy` field is updatable, and this does not affect Vercel. So it is just a case // of setting terraform state. -func (r resourceDeployment) Update(ctx context.Context, req tfsdk.UpdateResourceRequest, resp *tfsdk.UpdateResourceResponse) { +func (r resourceDeployment) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { var plan Deployment diags := req.Plan.Get(ctx, &plan) resp.Diagnostics.Append(diags...) @@ -395,7 +397,7 @@ func (r resourceDeployment) Update(ctx context.Context, req tfsdk.UpdateResource // Delete conditionally deletes a Deployment. // Typically, Vercel users do not delete old Deployments so deployments will be deleted only if delete_on_destroy // parameter is set to true. -func (r resourceDeployment) Delete(ctx context.Context, req tfsdk.DeleteResourceRequest, resp *tfsdk.DeleteResourceResponse) { +func (r resourceDeployment) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { var state Deployment diags := req.State.Get(ctx, &state) resp.Diagnostics.Append(diags...) diff --git a/vercel/resource_dns_record.go b/vercel/resource_dns_record.go index 942741bd..e6085c19 100644 --- a/vercel/resource_dns_record.go +++ b/vercel/resource_dns_record.go @@ -6,6 +6,8 @@ import ( "fmt" "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/provider" + "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/tfsdk" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" @@ -31,12 +33,12 @@ For more detailed information, please see the [Vercel documentation](https://ver "team_id": { Optional: true, Description: "The team ID that the domain and DNS records belong to.", - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Type: types.StringType, }, "domain": { Description: "The domain name, or zone, that the DNS record should be created beneath.", - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Required: true, Type: types.StringType, }, @@ -47,7 +49,7 @@ For more detailed information, please see the [Vercel documentation](https://ver }, "type": { Description: "The type of DNS record.", - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Required: true, Type: types.StringType, Validators: []tfsdk.AttributeValidator{ @@ -121,18 +123,18 @@ For more detailed information, please see the [Vercel documentation](https://ver } // NewResource instantiates a new Resource of this ResourceType. -func (r resourceDNSRecordType) NewResource(_ context.Context, p tfsdk.Provider) (tfsdk.Resource, diag.Diagnostics) { +func (r resourceDNSRecordType) NewResource(_ context.Context, p provider.Provider) (resource.Resource, diag.Diagnostics) { return resourceDNSRecord{ - p: *(p.(*provider)), + p: *(p.(*vercelProvider)), }, nil } type resourceDNSRecord struct { - p provider + p vercelProvider } // ValidateConfig validates the Resource configuration. -func (r resourceDNSRecord) ValidateConfig(ctx context.Context, req tfsdk.ValidateResourceConfigRequest, resp *tfsdk.ValidateResourceConfigResponse) { +func (r resourceDNSRecord) ValidateConfig(ctx context.Context, req resource.ValidateConfigRequest, resp *resource.ValidateConfigResponse) { var config DNSRecord diags := req.Config.Get(ctx, &config) resp.Diagnostics.Append(diags...) @@ -177,7 +179,7 @@ func (r resourceDNSRecord) ValidateConfig(ctx context.Context, req tfsdk.Validat // Create will create a DNS record within Vercel by calling the Vercel API. // This is called automatically by the provider when a new resource should be created. -func (r resourceDNSRecord) Create(ctx context.Context, req tfsdk.CreateResourceRequest, resp *tfsdk.CreateResourceResponse) { +func (r resourceDNSRecord) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { if !r.p.configured { resp.Diagnostics.AddError( "Provider not configured", @@ -225,7 +227,7 @@ func (r resourceDNSRecord) Create(ctx context.Context, req tfsdk.CreateResourceR // Read will read a DNS record from the vercel API and provide terraform with information about it. // It is called by the provider whenever values should be read to update state. -func (r resourceDNSRecord) Read(ctx context.Context, req tfsdk.ReadResourceRequest, resp *tfsdk.ReadResourceResponse) { +func (r resourceDNSRecord) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { var state DNSRecord diags := req.State.Get(ctx, &state) resp.Diagnostics.Append(diags...) @@ -273,7 +275,7 @@ func (r resourceDNSRecord) Read(ctx context.Context, req tfsdk.ReadResourceReque } // Update will update a DNS record via the vercel API. -func (r resourceDNSRecord) Update(ctx context.Context, req tfsdk.UpdateResourceRequest, resp *tfsdk.UpdateResourceResponse) { +func (r resourceDNSRecord) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { var plan DNSRecord diags := req.Plan.Get(ctx, &plan) resp.Diagnostics.Append(diags...) @@ -329,7 +331,7 @@ func (r resourceDNSRecord) Update(ctx context.Context, req tfsdk.UpdateResourceR } // Delete a DNS record from within terraform. -func (r resourceDNSRecord) Delete(ctx context.Context, req tfsdk.DeleteResourceRequest, resp *tfsdk.DeleteResourceResponse) { +func (r resourceDNSRecord) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { var state DNSRecord diags := req.State.Get(ctx, &state) resp.Diagnostics.Append(diags...) @@ -364,7 +366,7 @@ func (r resourceDNSRecord) Delete(ctx context.Context, req tfsdk.DeleteResourceR } // ImportState takes an identifier and reads all the DNS Record information from the Vercel API. -func (r resourceDNSRecord) ImportState(ctx context.Context, req tfsdk.ImportResourceStateRequest, resp *tfsdk.ImportResourceStateResponse) { +func (r resourceDNSRecord) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { teamID, recordID, ok := splitID(req.ID) if !ok { resp.Diagnostics.AddError( diff --git a/vercel/resource_project.go b/vercel/resource_project.go index 11e2ae44..b92d7e71 100644 --- a/vercel/resource_project.go +++ b/vercel/resource_project.go @@ -8,6 +8,8 @@ import ( "strings" "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/provider" + "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/tfsdk" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" @@ -30,7 +32,7 @@ For more detailed information, please see the [Vercel documentation](https://ver "team_id": { Optional: true, Type: types.StringType, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Description: "The team ID to add the project to.", }, "name": { @@ -119,10 +121,10 @@ For more detailed information, please see the [Vercel documentation](https://ver "id": { Description: "The ID of the environment variable", Type: types.StringType, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.UseStateForUnknown()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.UseStateForUnknown()}, Computed: true, }, - }, tfsdk.SetNestedAttributesOptions{}), + }), }, "framework": { Optional: true, @@ -135,7 +137,7 @@ For more detailed information, please see the [Vercel documentation](https://ver "git_repository": { Description: "The Git Repository that will be connected to the project. When this is defined, any pushes to the specified connected Git Repository will be automatically deployed. This requires the corresponding Vercel for [Github](https://vercel.com/docs/concepts/git/vercel-for-github), [Gitlab](https://vercel.com/docs/concepts/git/vercel-for-gitlab) or [Bitbucket](https://vercel.com/docs/concepts/git/vercel-for-bitbucket) plugins to be installed.", Optional: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Attributes: tfsdk.SingleNestedAttributes(map[string]tfsdk.Attribute{ "type": { Description: "The git provider of the repository. Must be either `github`, `gitlab`, or `bitbucket`.", @@ -144,20 +146,20 @@ For more detailed information, please see the [Vercel documentation](https://ver Validators: []tfsdk.AttributeValidator{ stringOneOf("github", "gitlab", "bitbucket"), }, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, }, "repo": { Description: "The name of the git repository. For example: `vercel/next.js`.", Type: types.StringType, Required: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, }, }), }, "id": { Computed: true, Type: types.StringType, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.UseStateForUnknown()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.UseStateForUnknown()}, }, "install_command": { Optional: true, @@ -184,19 +186,19 @@ For more detailed information, please see the [Vercel documentation](https://ver } // NewResource instantiates a new Resource of this ResourceType. -func (r resourceProjectType) NewResource(_ context.Context, p tfsdk.Provider) (tfsdk.Resource, diag.Diagnostics) { +func (r resourceProjectType) NewResource(_ context.Context, p provider.Provider) (resource.Resource, diag.Diagnostics) { return resourceProject{ - p: *(p.(*provider)), + p: *(p.(*vercelProvider)), }, nil } type resourceProject struct { - p provider + p vercelProvider } // Create will create a project within Vercel by calling the Vercel API. // This is called automatically by the provider when a new resource should be created. -func (r resourceProject) Create(ctx context.Context, req tfsdk.CreateResourceRequest, resp *tfsdk.CreateResourceResponse) { +func (r resourceProject) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { if !r.p.configured { resp.Diagnostics.AddError( "Provider not configured", @@ -236,7 +238,7 @@ func (r resourceProject) Create(ctx context.Context, req tfsdk.CreateResourceReq // Read will read a project from the vercel API and provide terraform with information about it. // It is called by the provider whenever values should be read to update state. -func (r resourceProject) Read(ctx context.Context, req tfsdk.ReadResourceRequest, resp *tfsdk.ReadResourceResponse) { +func (r resourceProject) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { var state Project diags := req.State.Get(ctx, &state) resp.Diagnostics.Append(diags...) @@ -314,7 +316,7 @@ func diffEnvVars(oldVars, newVars []EnvironmentItem) (toUpsert, toRemove []Envir // Update will update a project and it's associated environment variables via the vercel API. // Environment variables are manually diffed and updated individually. Once the environment // variables are all updated, the project is updated too. -func (r resourceProject) Update(ctx context.Context, req tfsdk.UpdateResourceRequest, resp *tfsdk.UpdateResourceResponse) { +func (r resourceProject) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { var plan Project diags := req.Plan.Get(ctx, &plan) resp.Diagnostics.Append(diags...) @@ -405,7 +407,7 @@ func (r resourceProject) Update(ctx context.Context, req tfsdk.UpdateResourceReq // Delete a project and any associated environment variables from within terraform. // Environment variables do not need to be explicitly deleted, as Vercel will automatically prune them. -func (r resourceProject) Delete(ctx context.Context, req tfsdk.DeleteResourceRequest, resp *tfsdk.DeleteResourceResponse) { +func (r resourceProject) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { var state Project diags := req.State.Get(ctx, &state) resp.Diagnostics.Append(diags...) @@ -452,7 +454,7 @@ func splitID(id string) (teamID, _id string, ok bool) { // ImportState takes an identifier and reads all the project information from the Vercel API. // Note that environment variables are also read. The results are then stored in terraform state. -func (r resourceProject) ImportState(ctx context.Context, req tfsdk.ImportResourceStateRequest, resp *tfsdk.ImportResourceStateResponse) { +func (r resourceProject) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { teamID, projectID, ok := splitID(req.ID) if !ok { resp.Diagnostics.AddError( diff --git a/vercel/resource_project_domain.go b/vercel/resource_project_domain.go index 5dba9b25..4a4cd5af 100644 --- a/vercel/resource_project_domain.go +++ b/vercel/resource_project_domain.go @@ -7,6 +7,8 @@ import ( "strings" "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/provider" + "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/tfsdk" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" @@ -28,24 +30,24 @@ By default, Project Domains will be automatically applied to any ` + "`productio "project_id": { Description: "The project ID to add the deployment to.", Required: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Type: types.StringType, }, "team_id": { Optional: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Type: types.StringType, Description: "The ID of the team the project exists under.", }, "id": { Computed: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.UseStateForUnknown()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.UseStateForUnknown()}, Type: types.StringType, }, "domain": { Description: "The domain name to associate with the project.", Required: true, - PlanModifiers: tfsdk.AttributePlanModifiers{tfsdk.RequiresReplace()}, + PlanModifiers: tfsdk.AttributePlanModifiers{resource.RequiresReplace()}, Type: types.StringType, }, "redirect": { @@ -71,19 +73,19 @@ By default, Project Domains will be automatically applied to any ` + "`productio } // NewResource instantiates a new Resource of this ResourceType. -func (r resourceProjectDomainType) NewResource(_ context.Context, p tfsdk.Provider) (tfsdk.Resource, diag.Diagnostics) { +func (r resourceProjectDomainType) NewResource(_ context.Context, p provider.Provider) (resource.Resource, diag.Diagnostics) { return resourceProjectDomain{ - p: *(p.(*provider)), + p: *(p.(*vercelProvider)), }, nil } type resourceProjectDomain struct { - p provider + p vercelProvider } // Create will create a project domain within Vercel. // This is called automatically by the provider when a new resource should be created. -func (r resourceProjectDomain) Create(ctx context.Context, req tfsdk.CreateResourceRequest, resp *tfsdk.CreateResourceResponse) { +func (r resourceProjectDomain) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { if !r.p.configured { resp.Diagnostics.AddError( "Provider not configured", @@ -139,7 +141,7 @@ func (r resourceProjectDomain) Create(ctx context.Context, req tfsdk.CreateResou // Read will read a project domain from the vercel API and provide terraform with information about it. // It is called by the provider whenever data source values should be read to update state. -func (r resourceProjectDomain) Read(ctx context.Context, req tfsdk.ReadResourceRequest, resp *tfsdk.ReadResourceResponse) { +func (r resourceProjectDomain) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { var state ProjectDomain diags := req.State.Get(ctx, &state) resp.Diagnostics.Append(diags...) @@ -179,7 +181,7 @@ func (r resourceProjectDomain) Read(ctx context.Context, req tfsdk.ReadResourceR } // Update will update a project domain via the vercel API. -func (r resourceProjectDomain) Update(ctx context.Context, req tfsdk.UpdateResourceRequest, resp *tfsdk.UpdateResourceResponse) { +func (r resourceProjectDomain) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { var plan ProjectDomain diags := req.Plan.Get(ctx, &plan) resp.Diagnostics.Append(diags...) @@ -221,7 +223,7 @@ func (r resourceProjectDomain) Update(ctx context.Context, req tfsdk.UpdateResou } // Delete will remove a project domain via the Vercel API. -func (r resourceProjectDomain) Delete(ctx context.Context, req tfsdk.DeleteResourceRequest, resp *tfsdk.DeleteResourceResponse) { +func (r resourceProjectDomain) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { var state ProjectDomain diags := req.State.Get(ctx, &state) resp.Diagnostics.Append(diags...) @@ -273,7 +275,7 @@ func splitProjectDomainID(id string) (teamID, projectID, domain string, ok bool) // ImportState takes an identifier and reads all the project domain information from the Vercel API. // Note that environment variables are also read. The results are then stored in terraform state. -func (r resourceProjectDomain) ImportState(ctx context.Context, req tfsdk.ImportResourceStateRequest, resp *tfsdk.ImportResourceStateResponse) { +func (r resourceProjectDomain) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { teamID, projectID, domain, ok := splitProjectDomainID(req.ID) if !ok { resp.Diagnostics.AddError( diff --git a/vercel/validator_framework.go b/vercel/validator_framework.go index 6f646e6e..c68e1c97 100644 --- a/vercel/validator_framework.go +++ b/vercel/validator_framework.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "github.com/hashicorp/terraform-plugin-framework/tfsdk" @@ -52,7 +52,7 @@ func (v validatorFramework) Validate(ctx context.Context, req tfsdk.ValidateAttr } defer apires.Body.Close() - responseBody, err := ioutil.ReadAll(apires.Body) + responseBody, err := io.ReadAll(apires.Body) if err != nil { resp.Diagnostics.AddAttributeError( req.AttributePath,