From 4a6d0aa205a74e1be230b496502b5b4ec06bcf00 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 07:45:23 +0000 Subject: [PATCH 1/5] chore(deps): bump github.com/supabase/cli from 1.169.3 to 1.198.1 Bumps [github.com/supabase/cli](https://github.com/supabase/cli) from 1.169.3 to 1.198.1. - [Release notes](https://github.com/supabase/cli/releases) - [Changelog](https://github.com/supabase/cli/blob/develop/.goreleaser.yml) - [Commits](https://github.com/supabase/cli/compare/v1.169.3...v1.198.1) --- updated-dependencies: - dependency-name: github.com/supabase/cli dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 23 ++++++++++++----------- go.sum | 48 ++++++++++++++++++++++++------------------------ 2 files changed, 36 insertions(+), 35 deletions(-) diff --git a/go.mod b/go.mod index 1040c04..373c4fb 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,7 @@ module github.com/supabase/terraform-provider-supabase go 1.22.0 +toolchain go1.22.5 require ( github.com/hashicorp/terraform-plugin-docs v0.19.4 @@ -9,7 +10,7 @@ require ( github.com/hashicorp/terraform-plugin-go v0.23.0 github.com/hashicorp/terraform-plugin-log v0.9.0 github.com/hashicorp/terraform-plugin-testing v1.10.0 - github.com/supabase/cli v1.169.3 + github.com/supabase/cli v1.198.1 gopkg.in/h2non/gock.v1 v1.1.2 ) @@ -56,10 +57,10 @@ require ( github.com/imdario/mergo v0.3.15 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-runewidth v0.0.15 // indirect + github.com/mattn/go-runewidth 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.0 // indirect + github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/oapi-codegen/runtime v1.1.1 // indirect @@ -76,17 +77,17 @@ require ( github.com/zclconf/go-cty v1.15.0 // indirect go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect golang.org/x/crypto v0.26.0 // indirect - golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect - golang.org/x/mod v0.19.0 // indirect - golang.org/x/net v0.26.0 // indirect + golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect + golang.org/x/mod v0.20.0 // indirect + golang.org/x/net v0.28.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.17.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/tools v0.24.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect - google.golang.org/grpc v1.64.1 // indirect - google.golang.org/protobuf v1.34.1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect + google.golang.org/grpc v1.66.2 // indirect + google.golang.org/protobuf v1.34.2 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 9cc5604..5d35d9f 100644 --- a/go.sum +++ b/go.sum @@ -34,8 +34,8 @@ github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZ github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= -github.com/cyphar/filepath-securejoin v0.2.5 h1:6iR5tXJ/e6tJZzzdMc1km3Sa7RRIVBKAK32O2s7AYfo= -github.com/cyphar/filepath-securejoin v0.2.5/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= +github.com/cyphar/filepath-securejoin v0.3.1 h1:1V7cHiaW+C+39wEfpH6XlLBQo3j/PciWFrgfCLS8XrE= +github.com/cyphar/filepath-securejoin v0.3.1/go.mod h1:F7i41x/9cBF7lzCrVsYs9fuzwRZm4NQsGTBdpp6mETc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -156,15 +156,15 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= -github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= +github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= -github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= -github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= +github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= +github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= @@ -207,8 +207,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/supabase/cli v1.169.3 h1:eX2Q80Yhs53WLOFDv61A5vAdC8hxB/3+FH+M0qEYJMM= -github.com/supabase/cli v1.169.3/go.mod h1:lCAXcngP/QMR1/xwpw4TT50ZA4PvDyacc4nAf2+iqDI= +github.com/supabase/cli v1.198.1 h1:JLih2UUF0EA5mB8PJwAexDEcomGpKeTYJJtWPhOaC1Y= +github.com/supabase/cli v1.198.1/go.mod h1:mogdUeM/Lqlo1bF7Dfbf2/H/M6YXVsWBS2eKQz8E+zY= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= @@ -234,18 +234,18 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= -golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= -golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8= -golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= +golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -264,8 +264,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= @@ -280,21 +280,21 @@ golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= +golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda h1:LI5DOvAxUPMv/50agcLLoo+AdWc1irS9Rzz4vPuD1V4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= -google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA= -google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= +google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= 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-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= From a28d26c91f9756cc20f328778d2d089bfcbca1aa Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Mon, 16 Sep 2024 23:36:04 +0800 Subject: [PATCH 2/5] chore: update go mod version --- go.mod | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 373c4fb..2d4c036 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,7 @@ module github.com/supabase/terraform-provider-supabase -go 1.22.0 +go 1.22.4 + toolchain go1.22.5 require ( From d499dada4a392083b5ce3e90f454cb833233d345 Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Mon, 16 Sep 2024 23:49:11 +0800 Subject: [PATCH 3/5] chore: update method names --- internal/provider/branch_data_source.go | 2 +- internal/provider/branch_resource.go | 12 ++++++------ internal/provider/pooler_data_source.go | 9 +++++---- internal/provider/project_resource.go | 8 ++++---- internal/provider/settings_resource.go | 18 +++++++++--------- 5 files changed, 25 insertions(+), 24 deletions(-) diff --git a/internal/provider/branch_data_source.go b/internal/provider/branch_data_source.go index d00b9b4..9296033 100644 --- a/internal/provider/branch_data_source.go +++ b/internal/provider/branch_data_source.go @@ -105,7 +105,7 @@ func (d *BranchDataSource) Read(ctx context.Context, req datasource.ReadRequest, // If applicable, this is a great opportunity to initialize any necessary // provider client data and make a call using it. - httpResp, err := d.client.GetBranchesWithResponse(ctx, projectRef.ValueString()) + httpResp, err := d.client.V1ListAllBranchesWithResponse(ctx, projectRef.ValueString()) if err != nil { msg := fmt.Sprintf("Unable to read branch, got error: %s", err) resp.Diagnostics.AddError("Client Error", msg) diff --git a/internal/provider/branch_resource.go b/internal/provider/branch_resource.go index 201a924..dcbfc59 100644 --- a/internal/provider/branch_resource.go +++ b/internal/provider/branch_resource.go @@ -240,7 +240,7 @@ func (r *BranchResource) ImportState(ctx context.Context, req resource.ImportSta } func updateBranch(ctx context.Context, plan *BranchResourceModel, client *api.ClientWithResponses) diag.Diagnostics { - httpResp, err := client.UpdateBranchWithResponse(ctx, plan.Id.ValueString(), api.UpdateBranchBody{ + httpResp, err := client.V1UpdateABranchConfigWithResponse(ctx, plan.Id.ValueString(), api.UpdateBranchBody{ BranchName: plan.GitBranch.ValueStringPointer(), GitBranch: plan.GitBranch.ValueStringPointer(), }) @@ -268,7 +268,7 @@ func readBranch(ctx context.Context, state *BranchResourceModel, client *api.Cli } func readBranchDatabase(ctx context.Context, state *BranchResourceModel, client *api.ClientWithResponses) diag.Diagnostics { - httpResp, err := client.GetBranchDetailsWithResponse(ctx, state.Id.ValueString()) + httpResp, err := client.V1GetABranchConfigWithResponse(ctx, state.Id.ValueString()) if err != nil { msg := fmt.Sprintf("Unable to read branch database, got error: %s", err) return diag.Diagnostics{diag.NewErrorDiagnostic("Client Error", msg)} @@ -294,14 +294,14 @@ func readBranchDatabase(ctx context.Context, state *BranchResourceModel, client } func createBranch(ctx context.Context, plan *BranchResourceModel, client *api.ClientWithResponses) diag.Diagnostics { - resp, err := client.GetBranches(ctx, plan.ParentProjectRef.ValueString()) + resp, err := client.V1ListAllBranches(ctx, plan.ParentProjectRef.ValueString()) if err != nil { msg := fmt.Sprintf("Unable to enable branching, got error: %s", err) return diag.Diagnostics{diag.NewErrorDiagnostic("Client Error", msg)} } // 1. Enable branching if resp.StatusCode == http.StatusUnprocessableEntity { - httpResp, err := client.CreateBranchWithResponse(ctx, plan.ParentProjectRef.ValueString(), api.CreateBranchBody{ + httpResp, err := client.V1CreateABranchWithResponse(ctx, plan.ParentProjectRef.ValueString(), api.CreateBranchBody{ BranchName: "Production", }) if err != nil { @@ -314,7 +314,7 @@ func createBranch(ctx context.Context, plan *BranchResourceModel, client *api.Cl } } // 2. Create branch database - httpResp, err := client.CreateBranchWithResponse(ctx, plan.ParentProjectRef.ValueString(), api.CreateBranchBody{ + httpResp, err := client.V1CreateABranchWithResponse(ctx, plan.ParentProjectRef.ValueString(), api.CreateBranchBody{ BranchName: plan.GitBranch.ValueString(), GitBranch: plan.GitBranch.ValueStringPointer(), Region: plan.Region.ValueStringPointer(), @@ -338,7 +338,7 @@ func createBranch(ctx context.Context, plan *BranchResourceModel, client *api.Cl } func deleteBranch(ctx context.Context, state *BranchResourceModel, client *api.ClientWithResponses) diag.Diagnostics { - httpResp, err := client.DeleteBranchWithResponse(ctx, state.Id.ValueString()) + httpResp, err := client.V1DeleteABranchWithResponse(ctx, state.Id.ValueString()) if err != nil { msg := fmt.Sprintf("Unable to delete branch, got error: %s", err) return diag.Diagnostics{diag.NewErrorDiagnostic("Client Error", msg)} diff --git a/internal/provider/pooler_data_source.go b/internal/provider/pooler_data_source.go index 8175fc9..56e6af5 100644 --- a/internal/provider/pooler_data_source.go +++ b/internal/provider/pooler_data_source.go @@ -87,7 +87,7 @@ func (d *PoolerDataSource) Read(ctx context.Context, req datasource.ReadRequest, // If applicable, this is a great opportunity to initialize any necessary // provider client data and make a call using it. - httpResp, err := d.client.V1GetPgbouncerConfigWithResponse(ctx, projectRef.ValueString()) + httpResp, err := d.client.V1GetSupavisorConfigWithResponse(ctx, projectRef.ValueString()) if err != nil { msg := fmt.Sprintf("Unable to read pooler, got error: %s", err) resp.Diagnostics.AddError("Client Error", msg) @@ -100,9 +100,10 @@ func (d *PoolerDataSource) Read(ctx context.Context, req datasource.ReadRequest, } url := map[string]string{} - if httpResp.JSON200.PoolMode != nil && httpResp.JSON200.ConnectionString != nil { - mode := string(*httpResp.JSON200.PoolMode) - url[mode] = *httpResp.JSON200.ConnectionString + for _, pooler := range *httpResp.JSON200 { + if pooler.DatabaseType == api.PRIMARY { + url[string(pooler.PoolMode)] = pooler.ConnectionString + } } // Write logs using the tflog package diff --git a/internal/provider/project_resource.go b/internal/provider/project_resource.go index a3ce31d..90b5aaa 100644 --- a/internal/provider/project_resource.go +++ b/internal/provider/project_resource.go @@ -180,7 +180,7 @@ func (r *ProjectResource) ImportState(ctx context.Context, req resource.ImportSt } func createProject(ctx context.Context, data *ProjectResourceModel, client *api.ClientWithResponses) diag.Diagnostics { - body := api.CreateProjectJSONRequestBody{ + body := api.V1CreateProjectBody{ OrganizationId: data.OrganizationId.ValueString(), Name: data.Name.ValueString(), DbPass: data.DatabasePassword.ValueString(), @@ -190,7 +190,7 @@ func createProject(ctx context.Context, data *ProjectResourceModel, client *api. body.DesiredInstanceSize = Ptr(api.DesiredInstanceSize(data.InstanceSize.ValueString())) } - httpResp, err := client.CreateProjectWithResponse(ctx, body) + httpResp, err := client.V1CreateAProjectWithResponse(ctx, body) if err != nil { msg := fmt.Sprintf("Unable to create project, got error: %s", err) return diag.Diagnostics{diag.NewErrorDiagnostic("Client Error", msg)} @@ -206,7 +206,7 @@ func createProject(ctx context.Context, data *ProjectResourceModel, client *api. } func readProject(ctx context.Context, data *ProjectResourceModel, client *api.ClientWithResponses) diag.Diagnostics { - httpResp, err := client.GetProjectsWithResponse(ctx) + httpResp, err := client.V1ListAllProjectsWithResponse(ctx) if err != nil { msg := fmt.Sprintf("Unable to read project, got error: %s", err) return diag.Diagnostics{diag.NewErrorDiagnostic("Client Error", msg)} @@ -232,7 +232,7 @@ func readProject(ctx context.Context, data *ProjectResourceModel, client *api.Cl } func deleteProject(ctx context.Context, data *ProjectResourceModel, client *api.ClientWithResponses) diag.Diagnostics { - httpResp, err := client.DeleteProjectWithResponse(ctx, data.Id.ValueString()) + httpResp, err := client.V1DeleteAProjectWithResponse(ctx, data.Id.ValueString()) if err != nil { msg := fmt.Sprintf("Unable to delete project, got error: %s", err) return diag.Diagnostics{diag.NewErrorDiagnostic("Client Error", msg)} diff --git a/internal/provider/settings_resource.go b/internal/provider/settings_resource.go index 42b6a7a..bf9c4d6 100644 --- a/internal/provider/settings_resource.go +++ b/internal/provider/settings_resource.go @@ -251,7 +251,7 @@ func (r *SettingsResource) ImportState(ctx context.Context, req resource.ImportS } func readApiConfig(ctx context.Context, state *SettingsResourceModel, client *api.ClientWithResponses) diag.Diagnostics { - httpResp, err := client.GetPostgRESTConfigWithResponse(ctx, state.Id.ValueString()) + httpResp, err := client.V1GetPostgrestServiceConfigWithResponse(ctx, state.Id.ValueString()) if err != nil { msg := fmt.Sprintf("Unable to read api settings, got error: %s", err) return diag.Diagnostics{diag.NewErrorDiagnostic("Client Error", msg)} @@ -280,7 +280,7 @@ func updateApiConfig(ctx context.Context, plan *SettingsResourceModel, client *a return diags } - httpResp, err := client.UpdatePostgRESTConfigWithResponse(ctx, plan.ProjectRef.ValueString(), body) + httpResp, err := client.V1UpdatePostgrestServiceConfigWithResponse(ctx, plan.ProjectRef.ValueString(), body) if err != nil { msg := fmt.Sprintf("Unable to update api settings, got error: %s", err) return diag.Diagnostics{diag.NewErrorDiagnostic("Client Error", msg)} @@ -298,7 +298,7 @@ func updateApiConfig(ctx context.Context, plan *SettingsResourceModel, client *a } func readAuthConfig(ctx context.Context, state *SettingsResourceModel, client *api.ClientWithResponses) diag.Diagnostics { - httpResp, err := client.GetV1AuthConfigWithResponse(ctx, state.Id.ValueString()) + httpResp, err := client.V1GetAuthServiceConfigWithResponse(ctx, state.Id.ValueString()) if err != nil { msg := fmt.Sprintf("Unable to read auth settings, got error: %s", err) return diag.Diagnostics{diag.NewErrorDiagnostic("Client Error", msg)} @@ -325,7 +325,7 @@ func updateAuthConfig(ctx context.Context, plan *SettingsResourceModel, client * return diags } - httpResp, err := client.UpdateV1AuthConfigWithResponse(ctx, plan.ProjectRef.ValueString(), body) + httpResp, err := client.V1UpdateAuthServiceConfigWithResponse(ctx, plan.ProjectRef.ValueString(), body) if err != nil { msg := fmt.Sprintf("Unable to update auth settings, got error: %s", err) return diag.Diagnostics{diag.NewErrorDiagnostic("Client Error", msg)} @@ -343,7 +343,7 @@ func updateAuthConfig(ctx context.Context, plan *SettingsResourceModel, client * } func readDatabaseConfig(ctx context.Context, state *SettingsResourceModel, client *api.ClientWithResponses) diag.Diagnostics { - httpResp, err := client.GetConfigWithResponse(ctx, state.Id.ValueString()) + httpResp, err := client.V1GetPostgresConfigWithResponse(ctx, state.Id.ValueString()) if err != nil { msg := fmt.Sprintf("Unable to read database settings, got error: %s", err) return diag.Diagnostics{diag.NewErrorDiagnostic("Client Error", msg)} @@ -370,7 +370,7 @@ func updateDatabaseConfig(ctx context.Context, plan *SettingsResourceModel, clie return diags } - httpResp, err := client.UpdateConfigWithResponse(ctx, plan.ProjectRef.ValueString(), body) + httpResp, err := client.V1UpdatePostgresConfigWithResponse(ctx, plan.ProjectRef.ValueString(), body) if err != nil { msg := fmt.Sprintf("Unable to update database settings, got error: %s", err) return diag.Diagnostics{diag.NewErrorDiagnostic("Client Error", msg)} @@ -434,7 +434,7 @@ type NetworkConfig struct { } func readNetworkConfig(ctx context.Context, state *SettingsResourceModel, client *api.ClientWithResponses) diag.Diagnostics { - httpResp, err := client.GetNetworkRestrictionsWithResponse(ctx, state.Id.ValueString()) + httpResp, err := client.V1GetNetworkRestrictionsWithResponse(ctx, state.Id.ValueString()) if err != nil { msg := fmt.Sprintf("Unable to read network settings, got error: %s", err) return diag.Diagnostics{diag.NewErrorDiagnostic("Client Error", msg)} @@ -470,7 +470,7 @@ func updateNetworkConfig(ctx context.Context, plan *SettingsResourceModel, clien return diags } - body := api.ApplyNetworkRestrictionsJSONRequestBody{ + body := api.NetworkRestrictionsRequest{ DbAllowedCidrs: &[]string{}, DbAllowedCidrsV6: &[]string{}, } @@ -491,7 +491,7 @@ func updateNetworkConfig(ctx context.Context, plan *SettingsResourceModel, clien } } - httpResp, err := client.ApplyNetworkRestrictionsWithResponse(ctx, plan.ProjectRef.ValueString(), body) + httpResp, err := client.V1UpdateNetworkRestrictionsWithResponse(ctx, plan.ProjectRef.ValueString(), body) if err != nil { msg := fmt.Sprintf("Unable to update network settings, got error: %s", err) return diag.Diagnostics{diag.NewErrorDiagnostic("Client Error", msg)} From 5a2b95ae1855a7fc764cf625b54a674a9db6b286 Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Mon, 16 Sep 2024 23:54:15 +0800 Subject: [PATCH 4/5] chore: update unit tests --- .../resources/supabase_settings/resource.tf | 5 ++++- internal/provider/pooler_data_source_test.go | 16 +++++++-------- internal/provider/settings_resource_test.go | 20 +++++++++++++++---- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/examples/resources/supabase_settings/resource.tf b/examples/resources/supabase_settings/resource.tf index e7573f7..d18040e 100644 --- a/examples/resources/supabase_settings/resource.tf +++ b/examples/resources/supabase_settings/resource.tf @@ -19,6 +19,9 @@ resource "supabase_settings" "production" { }) auth = jsonencode({ - site_url = "http://localhost:3000" + site_url = "http://localhost:3000" + mailer_otp_exp = 3600 + mfa_phone_otp_length = 6 + sms_otp_length = 6 }) } diff --git a/internal/provider/pooler_data_source_test.go b/internal/provider/pooler_data_source_test.go index 3b9c701..0d2a396 100644 --- a/internal/provider/pooler_data_source_test.go +++ b/internal/provider/pooler_data_source_test.go @@ -18,16 +18,16 @@ func TestAccPoolerDataSource(t *testing.T) { // Setup mock api defer gock.OffAll() gock.New("https://api.supabase.com"). - Get("/v1/projects/mayuaycdtijbctgqbycg/config/database/pgbouncer"). + Get("/v1/projects/mayuaycdtijbctgqbycg/config/database/pooler"). Times(3). Reply(http.StatusOK). - JSON(api.V1PgbouncerConfigResponse{ - ConnectionString: &poolerUrl, - DefaultPoolSize: Ptr(float32(15)), - IgnoreStartupParameters: Ptr(""), - MaxClientConn: Ptr(float32(200)), - PoolMode: Ptr(api.Transaction), - }) + JSON([]api.SupavisorConfigResponse{{ + DatabaseType: api.PRIMARY, + ConnectionString: poolerUrl, + DefaultPoolSize: Ptr(float32(15)), + MaxClientConn: Ptr(float32(200)), + PoolMode: api.SupavisorConfigResponsePoolModeTransaction, + }}) // Run test resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, diff --git a/internal/provider/settings_resource_test.go b/internal/provider/settings_resource_test.go index 6bdebca..8763c62 100644 --- a/internal/provider/settings_resource_test.go +++ b/internal/provider/settings_resource_test.go @@ -67,13 +67,19 @@ func TestAccSettingsResource(t *testing.T) { Get("/v1/projects/mayuaycdtijbctgqbycg/config/auth"). Reply(http.StatusOK). JSON(api.AuthConfigResponse{ - SiteUrl: Ptr("http://localhost:3000"), + SiteUrl: Ptr("http://localhost:3000"), + MailerOtpExp: 3600, + MfaPhoneOtpLength: 6, + SmsOtpLength: 6, }) gock.New("https://api.supabase.com"). Patch("/v1/projects/mayuaycdtijbctgqbycg/config/auth"). Reply(http.StatusOK). JSON(api.AuthConfigResponse{ - SiteUrl: Ptr("http://localhost:3000"), + SiteUrl: Ptr("http://localhost:3000"), + MailerOtpExp: 3600, + MfaPhoneOtpLength: 6, + SmsOtpLength: 6, }) // Step 2: read gock.New("https://api.supabase.com"). @@ -126,13 +132,19 @@ func TestAccSettingsResource(t *testing.T) { Get("/v1/projects/mayuaycdtijbctgqbycg/config/auth"). Reply(http.StatusOK). JSON(api.AuthConfigResponse{ - SiteUrl: Ptr("http://localhost:3000"), + SiteUrl: Ptr("http://localhost:3000"), + MailerOtpExp: 3600, + MfaPhoneOtpLength: 6, + SmsOtpLength: 6, }) gock.New("https://api.supabase.com"). Get("/v1/projects/mayuaycdtijbctgqbycg/config/auth"). Reply(http.StatusOK). JSON(api.AuthConfigResponse{ - SiteUrl: Ptr("http://localhost:3000"), + SiteUrl: Ptr("http://localhost:3000"), + MailerOtpExp: 3600, + MfaPhoneOtpLength: 6, + SmsOtpLength: 6, }) // Step 3: update gock.New("https://api.supabase.com"). From ce8c6d8935194b22fd9dcb18b6a5d8a0ada8861e Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Tue, 17 Sep 2024 00:40:36 +0800 Subject: [PATCH 5/5] chore: update example docs --- docs/resources/settings.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/resources/settings.md b/docs/resources/settings.md index 39635e0..b76569d 100644 --- a/docs/resources/settings.md +++ b/docs/resources/settings.md @@ -34,7 +34,10 @@ resource "supabase_settings" "production" { }) auth = jsonencode({ - site_url = "http://localhost:3000" + site_url = "http://localhost:3000" + mailer_otp_exp = 3600 + mfa_phone_otp_length = 6 + sms_otp_length = 6 }) } ```