Update dependencies (#112)
* Update dependencies * Remove set timeout * Remove set sleep before wait * Update to new signature, remove unnecessary calls --------- Co-authored-by: Henrique Santos <henrique.santos@freiheit.com>
This commit is contained in:
parent
70cb3d1519
commit
8f5850cdf1
28 changed files with 144 additions and 344 deletions
34
go.mod
34
go.mod
|
|
@ -11,21 +11,21 @@ require (
|
|||
github.com/hashicorp/terraform-plugin-go v0.19.0
|
||||
github.com/hashicorp/terraform-plugin-log v0.9.0
|
||||
github.com/hashicorp/terraform-plugin-testing v1.5.1
|
||||
github.com/stackitcloud/stackit-sdk-go/core v0.3.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/argus v0.5.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.4.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.4.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.5.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.5.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.5.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.5.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.4.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.5.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.5.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/redis v0.5.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.4.0
|
||||
github.com/stackitcloud/stackit-sdk-go/core v0.4.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/argus v0.6.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.5.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.5.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.6.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.6.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.6.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.6.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.5.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.6.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.6.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/redis v0.6.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.5.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.3.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/ske v0.4.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/ske v0.5.0
|
||||
golang.org/x/mod v0.13.0
|
||||
)
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ require (
|
|||
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
|
||||
github.com/cloudflare/circl v1.3.3 // indirect
|
||||
github.com/fatih/color v1.15.0 // indirect
|
||||
github.com/go-logr/logr v1.2.4 // indirect
|
||||
github.com/go-logr/logr v1.3.0 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/hashicorp/errwrap v1.0.0 // indirect
|
||||
|
|
@ -66,10 +66,10 @@ require (
|
|||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
github.com/oklog/run v1.1.0 // indirect
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.5.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.6.0
|
||||
github.com/stretchr/testify v1.8.3 // indirect
|
||||
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.0 // indirect
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
|
||||
github.com/zclconf/go-cty v1.14.0 // indirect
|
||||
golang.org/x/crypto v0.14.0 // indirect
|
||||
|
|
|
|||
68
go.sum
68
go.sum
|
|
@ -26,8 +26,8 @@ github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66D
|
|||
github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4=
|
||||
github.com/go-git/go-git/v5 v5.8.1 h1:Zo79E4p7TRk0xoRgMq0RShiTHGKcKI4+DI6BfJc/Q+A=
|
||||
github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
|
||||
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY=
|
||||
github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
|
||||
github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE=
|
||||
github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||
|
|
@ -131,38 +131,38 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
|
|||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
|
||||
github.com/skeema/knownhosts v1.2.0 h1:h9r9cf0+u7wSE+M183ZtMGgOJKiL96brpaz5ekfJCpM=
|
||||
github.com/stackitcloud/stackit-sdk-go/core v0.3.0 h1:bo29K6XMgUFhnvLJZ0dd/hWAltuDU+Qli7WqnKd2FbM=
|
||||
github.com/stackitcloud/stackit-sdk-go/core v0.3.0/go.mod h1:gNsJT/70wQ0hNgbObqlKl8Y9SQVg8crnFLwqdzFF8Q0=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/argus v0.5.0 h1:BhmXA4W9P0/ttfX8S4msyOp5XwqKfx6m6uHFpqHvvG0=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/argus v0.5.0/go.mod h1:fXyRrqMy2UegCRYXBYpVHcGLU41Ms0LCeTzxoYde7OI=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.4.0 h1:UKHDM/hKTkv5rsOH+a/7osGQaWq20MvKwETpico8akE=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.4.0/go.mod h1:Eyn/LRYMRtc4BB8uBxV21QA/xMUdUTkTG5ub0Q6pLVM=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.4.0 h1:YekLgXsp+nGjU3YY0mBDMc1lfNJnAuxoL1Ll7YWwv5k=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.4.0/go.mod h1:1NYHA58uZ6FJiTHBK3+HveSsz16PbuW0/wstq6iVT0I=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.5.0 h1:Y/AX0/yDcVvFZrK4uLJX26AdYsLxVxBlWt1mvgt/bG4=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.5.0/go.mod h1:Y0rtIUiDcfJLTSNbLX7wQ2N9nF1AC/WdAt45WZvZ1AM=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.5.0 h1:VFm22pao/FZRVQidPA3bg2mR76uIG8Mc2Um6EBN4rPk=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.5.0/go.mod h1:PJfIEXZScKv18W37UO9+e2l0L9lY4Ga7gpLc9Lz+tQE=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.5.0 h1:gPNytPOW87hyVVBrguASZT7dV00yfEnJtOrml4fChCE=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.5.0/go.mod h1:lVbM+WQ6JiMf0A3BA5CwSDvK8rjCgTadvpeQi6mohCY=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.5.0 h1:EuQpY6ewVCyKjRikr9zT1OzEqbSmxXaD0fpFFykHfKU=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.5.0/go.mod h1:ZRei8jDSmaime4kiGZZSiO2zIFHlmWl2lC5b1XP/X9g=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.5.0 h1:RuGCF+8dcLwaI7OuK1/jKDOplJxcXYhEEXOHLdf4Bd4=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.5.0/go.mod h1:T0cUEpwLnvZ/yTeoXCjc7pfi6O3WWl3BnRPsxyhgg0o=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.4.0 h1:o2WncmpUDzhAIHkv2ubD/HBjbbNdNFnYPZpcfYSXwPU=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.4.0/go.mod h1:HFq21TZSuvM8jCvgIG6wqgGAuEMMU4T/wiQXf+nBGHI=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.5.0 h1:9hkjos1SoPjaCAe5TESMqwlUR4uv53HcyYF7EoFmVyA=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.5.0/go.mod h1:XIfKeBZWO2WL1N83H7Iq4JgpcskvCeC5hESqfvlhkxc=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.5.0 h1:iiEAkxut9dBVbALPg2QRYPbFV91gvHVJadAkZAqKwQI=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.5.0/go.mod h1:xdOjx4GhqhvB1W2+N+D/TeURoLu49107s5zPuG0OnE8=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/redis v0.5.0 h1:itVDMWbQy1+AQAsAuz5ZFR5CzDGQA/j5qrYj+N1OoYs=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/redis v0.5.0/go.mod h1:HhOZ5w8BTYSWMRB2cz3MBpA99sx56TAcpUvo+fNp1RI=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.4.0 h1:Oty6YYtDRJ8twLPWK7R1jLXAzDmieua8tDQ7eykfRqA=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.4.0/go.mod h1:NafGFXQCb2qpr/OaC/4923YOBoubdFWT8yC2JJH50v0=
|
||||
github.com/stackitcloud/stackit-sdk-go/core v0.4.0 h1:CiHaAph5x1yXCPpb4ctpl6qgsOv4EMBBPfs54hGRf5I=
|
||||
github.com/stackitcloud/stackit-sdk-go/core v0.4.0/go.mod h1:FXoqSf7npgGS7vHuF3zr7OFscwhAxSZU43Wlj6L+TR4=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/argus v0.6.0 h1:2XfMGaWvJjEsA1yDtGH0/5JKljB0TrQ2bHKU8KiznGU=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/argus v0.6.0/go.mod h1:XI8wUfj8f147sc7B/kVO5MSxCsaueZqAMSSdwJNRiQI=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.5.0 h1:BlH9H0mYAeVwUa2bD02Kom5rjWWwCqruhpFALNvzKfc=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.5.0/go.mod h1:FY00NRurnDAA0gjopm1QgZhpd6iZlcg1giWr3SHSvJg=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.5.0 h1:/HOVhcshDGgjUK7SVUj7Usrk2FWRzd9Q47DdOCgIzrw=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.5.0/go.mod h1:gzxHBYsRzOptjljttTKMskAX0NobTDkwfVJkNU02uzs=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.6.0 h1:HB4Y7QSBN+4IjJlRCOasaBPTDS3rOnLj3e5XQeROD3Q=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.6.0/go.mod h1:eFvKHU0GRKk9InCrfenbPCPQfXZ1e3I21FtqLWZ4U00=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.6.0 h1:V+a7EdDeEu+7wriaL83E+HC3Tt6oO0mkICepYftuI6Q=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.6.0/go.mod h1:JMxwLrojwN0zQLpRg7N19J6dWMZzmlsg3rXBwMsWTFA=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.6.0 h1:hylEa9Di/yBszlHGgGV6gwwKuJzfFFi1HbodOXStHKc=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.6.0/go.mod h1:T+9ElPoejyN3eLMThi6+xqlRYwvqEL6ej4I/riSI4z0=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.6.0 h1:fWkx7NNn+J2MisUkpYJe9hEV+NIBkC52srcq+6CiWbs=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.6.0/go.mod h1:GvL/3XhR9YQm547MpizMr5miNqAl5JdZ5qN3e/CZ60Y=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.6.0 h1:GAKBlsqVN+Gs9ar8nKMscESBa05CfpHu6wpm+RGgTiY=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.6.0/go.mod h1:XX5rsgY5/CzjmjtKoCkaxBVbpDhPcHK9CO6S5rw8Lnk=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.5.0 h1:Jn4mfIlY8xOJKpSG7mlN6auFoS64DrpGgSzMnav8a1g=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.5.0/go.mod h1:osQ0C+W/DmFP368P2aWL82dRoRt6KoDPfuR1Fq8uaas=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.6.0 h1:AohTXdpqmqSwxIbAwPS7XUrK7cqRMtPmHpPV2dnQYSo=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.6.0/go.mod h1:DBh6FYiz/NIUIWQFMu3+Py9ghmOQKFeI6Lig7NiwDu4=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.6.0 h1:0sp7gq/GQnspyBzX1LCKOFqOuc44xQ8IFRqK3JB25Gg=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.6.0/go.mod h1:XEXUQYNmc+cPJZASxuTIXb3GzriIxq/O16Ha4mr/H78=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/redis v0.6.0 h1:q8xwJW/Xm7rohZYz3O2ifo2ktBwJrJWARSfU8lL4vA4=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/redis v0.6.0/go.mod h1:otuFJVUqV0ublbdmWlnEQl5GeCiAUzzhk0qsp20av+c=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.5.0 h1:fWX/0G4fbe0zbqswMNtSE4f0ZQNe3Fbbpm6FY3Gilqc=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.5.0/go.mod h1:dCmZFIVETawv81ndbPniSaByba4GaNNuPon7VwLgNIk=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.3.0 h1:qjYzBltZ4G7A79r1xbWOvBRkOg61SbuOGrL+dB3akYs=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.3.0/go.mod h1:2n97tLGzFJo8N762/oloN31Al1RuDebthYuG8RdHidk=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/ske v0.4.0 h1:l0PIsYKwbnRHqtxERQrSyDy5jE3yWmAe2SdYIGaPuLU=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/ske v0.4.0/go.mod h1:0VJq6NZiW2uYOaILYRmQ34//Te2hDFQ08MqMWw7/+CI=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/ske v0.5.0 h1:xxG8VX8TTupf6KTICTqm0rfvRAS8HM81x1t6EZ3EbNA=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/ske v0.5.0/go.mod h1:IQPg/moQqtYsWeMlOnzUP6oH5dl5vGrWdklYKnyrpW8=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
|
||||
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
|
||||
|
|
@ -170,8 +170,8 @@ github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl
|
|||
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=
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.0 h1:hRM0digJwyR6vll33NNAwCFguy5JuBD6jxDmQP3l608=
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.0/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8=
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
|
||||
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/attr"
|
||||
|
|
@ -288,19 +287,14 @@ func (r *instanceResource) Create(ctx context.Context, req resource.CreateReques
|
|||
}
|
||||
instanceId := createResp.InstanceId
|
||||
ctx = tflog.SetField(ctx, "instance_id", instanceId)
|
||||
wr, err := wait.CreateInstanceWaitHandler(ctx, r.client, *instanceId, projectId).SetTimeout(20 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateInstanceWaitHandler(ctx, r.client, *instanceId, projectId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Instance creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*argus.InstanceResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(ctx, got, &model)
|
||||
err = mapFields(ctx, waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -378,18 +372,13 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
wr, err := wait.UpdateInstanceWaitHandler(ctx, r.client, instanceId, projectId).SetTimeout(20 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.UpdateInstanceWaitHandler(ctx, r.client, instanceId, projectId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Instance update waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*argus.InstanceResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
err = mapFields(ctx, got, &model)
|
||||
err = mapFields(ctx, waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -421,7 +410,7 @@ func (r *instanceResource) Delete(ctx context.Context, req resource.DeleteReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
_, err = wait.DeleteInstanceWaitHandler(ctx, r.client, instanceId, projectId).SetTimeout(10 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteInstanceWaitHandler(ctx, r.client, instanceId, projectId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Instance deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ func (r *scrapeConfigResource) Create(ctx context.Context, req resource.CreateRe
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating scrape config", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
_, err = wait.CreateScrapeConfigWaitHandler(ctx, r.client, instanceId, scName, projectId).SetTimeout(3 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.CreateScrapeConfigWaitHandler(ctx, r.client, instanceId, scName, projectId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating scrape config", fmt.Sprintf("Scrape config creation waiting: %v", err))
|
||||
return
|
||||
|
|
@ -411,7 +411,7 @@ func (r *scrapeConfigResource) Delete(ctx context.Context, req resource.DeleteRe
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting scrape config", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
_, err = wait.DeleteScrapeConfigWaitHandler(ctx, r.client, instanceId, scName, projectId).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteScrapeConfigWaitHandler(ctx, r.client, instanceId, scName, projectId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting scrape config", fmt.Sprintf("Scrape config deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
|
||||
|
|
@ -236,19 +235,14 @@ func (r *recordSetResource) Create(ctx context.Context, req resource.CreateReque
|
|||
}
|
||||
ctx = tflog.SetField(ctx, "record_set_id", *recordSetResp.Rrset.Id)
|
||||
|
||||
wr, err := wait.CreateRecordSetWaitHandler(ctx, r.client, projectId, zoneId, *recordSetResp.Rrset.Id).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateRecordSetWaitHandler(ctx, r.client, projectId, zoneId, *recordSetResp.Rrset.Id).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating record set", fmt.Sprintf("Instance creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*dns.RecordSetResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating record set", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating record set", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -328,24 +322,13 @@ func (r *recordSetResource) Update(ctx context.Context, req resource.UpdateReque
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating record set", err.Error())
|
||||
return
|
||||
}
|
||||
wr, err := wait.UpdateRecordSetWaitHandler(ctx, r.client, projectId, zoneId, recordSetId).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.UpdateRecordSetWaitHandler(ctx, r.client, projectId, zoneId, recordSetId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating record set", fmt.Sprintf("Instance update waiting: %v", err))
|
||||
return
|
||||
}
|
||||
_, ok := wr.(*dns.RecordSetResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating record set", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Fetch updated record set
|
||||
recordSetResp, err := r.client.GetRecordSet(ctx, projectId, zoneId, recordSetId).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating record set", fmt.Sprintf("Calling API for updated data: %v", err))
|
||||
return
|
||||
}
|
||||
err = mapFields(recordSetResp, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating record set", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -380,7 +363,7 @@ func (r *recordSetResource) Delete(ctx context.Context, req resource.DeleteReque
|
|||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting record set", fmt.Sprintf("Calling API: %v", err))
|
||||
}
|
||||
_, err = wait.DeleteRecordSetWaitHandler(ctx, r.client, projectId, zoneId, recordSetId).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteRecordSetWaitHandler(ctx, r.client, projectId, zoneId, recordSetId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting record set", fmt.Sprintf("Instance deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import (
|
|||
"fmt"
|
||||
"math"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
|
||||
|
|
@ -321,19 +320,14 @@ func (r *zoneResource) Create(ctx context.Context, req resource.CreateRequest, r
|
|||
zoneId := *createResp.Zone.Id
|
||||
|
||||
ctx = tflog.SetField(ctx, "zone_id", zoneId)
|
||||
wr, err := wait.CreateZoneWaitHandler(ctx, r.client, projectId, zoneId).SetTimeout(10 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateZoneWaitHandler(ctx, r.client, projectId, zoneId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating zone", fmt.Sprintf("Zone creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*dns.ZoneResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating zone", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating zone", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -407,24 +401,13 @@ func (r *zoneResource) Update(ctx context.Context, req resource.UpdateRequest, r
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating zone", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
wr, err := wait.UpdateZoneWaitHandler(ctx, r.client, projectId, zoneId).SetTimeout(10 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.UpdateZoneWaitHandler(ctx, r.client, projectId, zoneId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating zone", fmt.Sprintf("Zone update waiting: %v", err))
|
||||
return
|
||||
}
|
||||
_, ok := wr.(*dns.ZoneResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating zone", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Fetch updated zone
|
||||
zoneResp, err := r.client.GetZone(ctx, projectId, zoneId).Execute()
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating zone", fmt.Sprintf("Calling API for updated data: %v", err))
|
||||
return
|
||||
}
|
||||
err = mapFields(zoneResp, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating zone", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -458,7 +441,7 @@ func (r *zoneResource) Delete(ctx context.Context, req resource.DeleteRequest, r
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting zone", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
_, err = wait.DeleteZoneWaitHandler(ctx, r.client, projectId, zoneId).SetTimeout(10 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteZoneWaitHandler(ctx, r.client, projectId, zoneId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting zone", fmt.Sprintf("Zone deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package loadbalancer
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/setvalidator"
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
||||
|
|
@ -406,16 +405,11 @@ func (r *projectResource) Create(ctx context.Context, req resource.CreateRequest
|
|||
return
|
||||
}
|
||||
|
||||
wr, err := wait.EnableLoadBalancingWaitHandler(ctx, r.client, projectId).SetTimeout(15 * time.Minute).WaitWithContext(ctx)
|
||||
_, err := wait.EnableLoadBalancingWaitHandler(ctx, r.client, projectId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error enabling load balancer functionality", fmt.Sprintf("Waiting for enablement: %v", err))
|
||||
return
|
||||
}
|
||||
_, ok := wr.(*loadbalancer.StatusResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Generate API request body from model
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
|
|
@ -207,19 +206,14 @@ func (r *credentialResource) Create(ctx context.Context, req resource.CreateRequ
|
|||
credentialId := *credentialsResp.Id
|
||||
ctx = tflog.SetField(ctx, "credential_id", credentialId)
|
||||
|
||||
wr, err := wait.CreateCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Instance creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*logme.CredentialsResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -296,7 +290,7 @@ func (r *credentialResource) Delete(ctx context.Context, req resource.DeleteRequ
|
|||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting credential", fmt.Sprintf("Calling API: %v", err))
|
||||
}
|
||||
_, err = wait.DeleteCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting credential", fmt.Sprintf("Instance deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/attr"
|
||||
|
|
@ -262,19 +261,14 @@ func (r *instanceResource) Create(ctx context.Context, req resource.CreateReques
|
|||
}
|
||||
instanceId := *createResp.InstanceId
|
||||
ctx = tflog.SetField(ctx, "instance_id", instanceId)
|
||||
wr, err := wait.CreateInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(45 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Instance creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*logme.Instance)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -371,19 +365,14 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
wr, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(45 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Instance update waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*logme.Instance)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -417,7 +406,7 @@ func (r *instanceResource) Delete(ctx context.Context, req resource.DeleteReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
_, err = wait.DeleteInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(15 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Instance deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
|
|
@ -207,19 +206,14 @@ func (r *credentialResource) Create(ctx context.Context, req resource.CreateRequ
|
|||
credentialId := *credentialsResp.Id
|
||||
ctx = tflog.SetField(ctx, "credential_id", credentialId)
|
||||
|
||||
wr, err := wait.CreateCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Instance creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*mariadb.CredentialsResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -296,7 +290,7 @@ func (r *credentialResource) Delete(ctx context.Context, req resource.DeleteRequ
|
|||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting credential", fmt.Sprintf("Calling API: %v", err))
|
||||
}
|
||||
_, err = wait.DeleteCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting credential", fmt.Sprintf("Instance deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/attr"
|
||||
|
|
@ -262,19 +261,14 @@ func (r *instanceResource) Create(ctx context.Context, req resource.CreateReques
|
|||
}
|
||||
instanceId := *createResp.InstanceId
|
||||
ctx = tflog.SetField(ctx, "instance_id", instanceId)
|
||||
wr, err := wait.CreateInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(45 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Instance creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*mariadb.Instance)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -371,19 +365,14 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
wr, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(45 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Instance update waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*mariadb.Instance)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -417,7 +406,7 @@ func (r *instanceResource) Delete(ctx context.Context, req resource.DeleteReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
_, err = wait.DeleteInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(15 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Instance deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import (
|
|||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/attr"
|
||||
|
|
@ -320,19 +319,14 @@ func (r *instanceResource) Create(ctx context.Context, req resource.CreateReques
|
|||
}
|
||||
instanceId := *createResp.Id
|
||||
ctx = tflog.SetField(ctx, "instance_id", instanceId)
|
||||
wr, err := wait.CreateInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(45 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Instance creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*mongodbflex.GetInstanceResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model, flavor, storage, options)
|
||||
err = mapFields(waitResp, &model, flavor, storage, options)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -471,19 +465,14 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", err.Error())
|
||||
return
|
||||
}
|
||||
wr, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(45 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Instance update waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*mongodbflex.GetInstanceResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model, flavor, storage, options)
|
||||
err = mapFields(waitResp, &model, flavor, storage, options)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -516,7 +505,7 @@ func (r *instanceResource) Delete(ctx context.Context, req resource.DeleteReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
_, err = wait.DeleteInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(15 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Instance deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
|
|
@ -169,19 +168,14 @@ func (r *bucketResource) Create(ctx context.Context, req resource.CreateRequest,
|
|||
return
|
||||
}
|
||||
|
||||
wr, err := wait.CreateBucketWaitHandler(ctx, r.client, projectId, bucketName).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateBucketWaitHandler(ctx, r.client, projectId, bucketName).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating bucket", fmt.Sprintf("Bucket creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*objectstorage.GetBucketResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating bucket", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating bucket", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -253,7 +247,7 @@ func (r *bucketResource) Delete(ctx context.Context, req resource.DeleteRequest,
|
|||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting bucket", fmt.Sprintf("Calling API: %v", err))
|
||||
}
|
||||
_, err = wait.DeleteBucketWaitHandler(ctx, r.client, projectId, bucketName).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteBucketWaitHandler(ctx, r.client, projectId, bucketName).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting bucket", fmt.Sprintf("Bucket deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
|
||||
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
|
||||
|
|
@ -265,7 +264,7 @@ func testAccCheckObjectStorageDestroy(s *terraform.State) error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("destroying bucket %s during CheckDestroy: %w", bucketName, err)
|
||||
}
|
||||
_, err = wait.DeleteBucketWaitHandler(ctx, client, testutil.ProjectId, bucketName).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteBucketWaitHandler(ctx, client, testutil.ProjectId, bucketName).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("destroying instance %s during CheckDestroy: waiting for deletion %w", bucketName, err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
|
|
@ -207,19 +206,14 @@ func (r *credentialResource) Create(ctx context.Context, req resource.CreateRequ
|
|||
credentialId := *credentialsResp.Id
|
||||
ctx = tflog.SetField(ctx, "credential_id", credentialId)
|
||||
|
||||
wr, err := wait.CreateCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Instance creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*opensearch.CredentialsResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -296,7 +290,7 @@ func (r *credentialResource) Delete(ctx context.Context, req resource.DeleteRequ
|
|||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting credential", fmt.Sprintf("Calling API: %v", err))
|
||||
}
|
||||
_, err = wait.DeleteCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting credential", fmt.Sprintf("Instance deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/attr"
|
||||
|
|
@ -262,19 +261,14 @@ func (r *instanceResource) Create(ctx context.Context, req resource.CreateReques
|
|||
}
|
||||
instanceId := *createResp.InstanceId
|
||||
ctx = tflog.SetField(ctx, "instance_id", instanceId)
|
||||
wr, err := wait.CreateInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(45 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Instance creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*opensearch.Instance)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -371,19 +365,14 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
wr, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(45 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Instance update waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*opensearch.Instance)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -417,7 +406,7 @@ func (r *instanceResource) Delete(ctx context.Context, req resource.DeleteReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
_, err = wait.DeleteInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(15 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Instance deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import (
|
|||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/attr"
|
||||
|
|
@ -289,19 +288,14 @@ func (r *instanceResource) Create(ctx context.Context, req resource.CreateReques
|
|||
}
|
||||
instanceId := *createResp.Id
|
||||
ctx = tflog.SetField(ctx, "instance_id", instanceId)
|
||||
wr, err := wait.CreateInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(45 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Instance creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*postgresflex.InstanceResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model, flavor, storage)
|
||||
err = mapFields(waitResp, &model, flavor, storage)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -422,19 +416,14 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", err.Error())
|
||||
return
|
||||
}
|
||||
wr, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(45 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Instance update waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*postgresflex.InstanceResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model, flavor, storage)
|
||||
err = mapFields(waitResp, &model, flavor, storage)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -467,7 +456,7 @@ func (r *instanceResource) Delete(ctx context.Context, req resource.DeleteReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
_, err = wait.DeleteInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(15 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Instance deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/setvalidator"
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
||||
|
|
@ -303,7 +302,7 @@ func (r *userResource) Delete(ctx context.Context, req resource.DeleteRequest, r
|
|||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting user", fmt.Sprintf("Calling API: %v", err))
|
||||
}
|
||||
_, err = wait.DeleteUserWaitHandler(ctx, r.client, projectId, instanceId, userId).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteUserWaitHandler(ctx, r.client, projectId, instanceId, userId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting user", fmt.Sprintf("Instance deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
|
|
@ -207,19 +206,14 @@ func (r *credentialResource) Create(ctx context.Context, req resource.CreateRequ
|
|||
credentialId := *credentialsResp.Id
|
||||
ctx = tflog.SetField(ctx, "credential_id", credentialId)
|
||||
|
||||
wr, err := wait.CreateCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Instance creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*postgresql.CredentialsResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -296,7 +290,7 @@ func (r *credentialResource) Delete(ctx context.Context, req resource.DeleteRequ
|
|||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting credential", fmt.Sprintf("Calling API: %v", err))
|
||||
}
|
||||
_, err = wait.DeleteCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting credential", fmt.Sprintf("Instance deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/attr"
|
||||
|
|
@ -302,19 +301,14 @@ func (r *instanceResource) Create(ctx context.Context, req resource.CreateReques
|
|||
}
|
||||
instanceId := *createResp.InstanceId
|
||||
ctx = tflog.SetField(ctx, "instance_id", instanceId)
|
||||
wr, err := wait.CreateInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(45 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Instance creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*postgresql.Instance)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -447,19 +441,14 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
wr, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(45 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Instance update waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*postgresql.Instance)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -516,7 +505,7 @@ func (r *instanceResource) Delete(ctx context.Context, req resource.DeleteReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
_, err = wait.DeleteInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(15 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Instance deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
|
|
@ -207,19 +206,14 @@ func (r *credentialResource) Create(ctx context.Context, req resource.CreateRequ
|
|||
credentialId := *credentialsResp.Id
|
||||
ctx = tflog.SetField(ctx, "credential_id", credentialId)
|
||||
|
||||
wr, err := wait.CreateCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Instance creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*rabbitmq.CredentialsResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -296,7 +290,7 @@ func (r *credentialResource) Delete(ctx context.Context, req resource.DeleteRequ
|
|||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting credential", fmt.Sprintf("Calling API: %v", err))
|
||||
}
|
||||
_, err = wait.DeleteCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting credential", fmt.Sprintf("Instance deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/attr"
|
||||
|
|
@ -262,19 +261,14 @@ func (r *instanceResource) Create(ctx context.Context, req resource.CreateReques
|
|||
}
|
||||
instanceId := *createResp.InstanceId
|
||||
ctx = tflog.SetField(ctx, "instance_id", instanceId)
|
||||
wr, err := wait.CreateInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(45 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Instance creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*rabbitmq.Instance)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -371,19 +365,14 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
wr, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(45 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Instance update waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*rabbitmq.Instance)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -417,7 +406,7 @@ func (r *instanceResource) Delete(ctx context.Context, req resource.DeleteReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
_, err = wait.DeleteInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(15 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Instance deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
|
|
@ -207,19 +206,14 @@ func (r *credentialResource) Create(ctx context.Context, req resource.CreateRequ
|
|||
credentialId := *credentialsResp.Id
|
||||
ctx = tflog.SetField(ctx, "credential_id", credentialId)
|
||||
|
||||
wr, err := wait.CreateCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Instance creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*redis.CredentialsResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -296,7 +290,7 @@ func (r *credentialResource) Delete(ctx context.Context, req resource.DeleteRequ
|
|||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting credential", fmt.Sprintf("Calling API: %v", err))
|
||||
}
|
||||
_, err = wait.DeleteCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).SetTimeout(1 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteCredentialsWaitHandler(ctx, r.client, projectId, instanceId, credentialId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting credential", fmt.Sprintf("Instance deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/attr"
|
||||
|
|
@ -262,19 +261,14 @@ func (r *instanceResource) Create(ctx context.Context, req resource.CreateReques
|
|||
}
|
||||
instanceId := *createResp.InstanceId
|
||||
ctx = tflog.SetField(ctx, "instance_id", instanceId)
|
||||
wr, err := wait.CreateInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(45 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Instance creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*redis.Instance)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -371,19 +365,14 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
wr, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(45 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.UpdateInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Instance update waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*redis.Instance)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(got, &model)
|
||||
err = mapFields(waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -417,7 +406,7 @@ func (r *instanceResource) Delete(ctx context.Context, req resource.DeleteReques
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
_, err = wait.DeleteInstanceWaitHandler(ctx, r.client, projectId, instanceId).SetTimeout(15 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteInstanceWaitHandler(ctx, r.client, projectId, instanceId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting instance", fmt.Sprintf("Instance deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import (
|
|||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/mapvalidator"
|
||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
||||
|
|
@ -206,19 +205,14 @@ func (r *projectResource) Create(ctx context.Context, req resource.CreateRequest
|
|||
|
||||
// If the request has not been processed yet and the containerId doesnt exist,
|
||||
// the waiter will fail with authentication error, so wait some time before checking the creation
|
||||
wr, err := wait.CreateProjectWaitHandler(ctx, r.client, respContainerId).SetSleepBeforeWait(1 * time.Minute).SetTimeout(10 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateProjectWaitHandler(ctx, r.client, respContainerId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating project", fmt.Sprintf("Instance creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*resourcemanager.ProjectResponseWithParents)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating project", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
// Map response body to schema
|
||||
err = mapFields(ctx, got, &model)
|
||||
err = mapFields(ctx, waitResp, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating project", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -328,7 +322,7 @@ func (r *projectResource) Delete(ctx context.Context, req resource.DeleteRequest
|
|||
return
|
||||
}
|
||||
|
||||
_, err = wait.DeleteProjectWaitHandler(ctx, r.client, containerId).SetTimeout(10 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteProjectWaitHandler(ctx, r.client, containerId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting project", fmt.Sprintf("Instance deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -575,21 +575,16 @@ func (r *clusterResource) createOrUpdateCluster(ctx context.Context, diags *diag
|
|||
return
|
||||
}
|
||||
|
||||
wr, err := wait.CreateOrUpdateClusterWaitHandler(ctx, r.client, projectId, name).SetTimeout(45 * time.Minute).WaitWithContext(ctx)
|
||||
waitResp, err := wait.CreateOrUpdateClusterWaitHandler(ctx, r.client, projectId, name).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, diags, "Error creating/updating cluster", fmt.Sprintf("Cluster creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
got, ok := wr.(*ske.ClusterResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, diags, "Error creating/updating cluster", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
if got.Status.Error != nil && got.Status.Error.Message != nil && *got.Status.Error.Code == wait.InvalidArgusInstanceErrorCode {
|
||||
core.LogAndAddWarning(ctx, diags, "Warning during creating/updating cluster", fmt.Sprintf("Cluster is in Impaired state due to an invalid argus instance id, the cluster is usable but metrics won't be forwarded: %s", *got.Status.Error.Message))
|
||||
if waitResp.Status.Error != nil && waitResp.Status.Error.Message != nil && *waitResp.Status.Error.Code == wait.InvalidArgusInstanceErrorCode {
|
||||
core.LogAndAddWarning(ctx, diags, "Warning during creating/updating cluster", fmt.Sprintf("Cluster is in Impaired state due to an invalid argus instance id, the cluster is usable but metrics won't be forwarded: %s", *waitResp.Status.Error.Message))
|
||||
}
|
||||
|
||||
err = mapFields(ctx, got, model)
|
||||
err = mapFields(ctx, waitResp, model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, diags, "Error creating/updating cluster", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
@ -1149,7 +1144,7 @@ func (r *clusterResource) Delete(ctx context.Context, req resource.DeleteRequest
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting cluster", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
_, err = wait.DeleteClusterWaitHandler(ctx, r.client, projectId, name).SetTimeout(15 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteClusterWaitHandler(ctx, r.client, projectId, name).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting cluster", fmt.Sprintf("Cluster deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/path"
|
||||
"github.com/hashicorp/terraform-plugin-framework/resource"
|
||||
|
|
@ -126,16 +125,12 @@ func (r *projectResource) Create(ctx context.Context, req resource.CreateRequest
|
|||
}
|
||||
|
||||
model.Id = types.StringValue(projectId)
|
||||
wr, err := wait.CreateProjectWaitHandler(ctx, r.client, projectId).SetTimeout(5 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.CreateProjectWaitHandler(ctx, r.client, projectId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating cluster", fmt.Sprintf("Project creation waiting: %v", err))
|
||||
return
|
||||
}
|
||||
_, ok := wr.(*ske.ProjectResponse)
|
||||
if !ok {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating cluster", fmt.Sprintf("Wait result conversion, got %+v", wr))
|
||||
return
|
||||
}
|
||||
|
||||
diags := resp.State.Set(ctx, model)
|
||||
resp.Diagnostics.Append(diags...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
|
|
@ -190,7 +185,7 @@ func (r *projectResource) Delete(ctx context.Context, req resource.DeleteRequest
|
|||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting credential", fmt.Sprintf("Calling API: %v", err))
|
||||
return
|
||||
}
|
||||
_, err = wait.DeleteProjectWaitHandler(ctx, r.client, projectId).SetTimeout(10 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteProjectWaitHandler(ctx, r.client, projectId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error deleting credential", fmt.Sprintf("Project deletion waiting: %v", err))
|
||||
return
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
|
||||
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
|
||||
|
|
@ -534,7 +533,7 @@ func testAccCheckSKEDestroy(s *terraform.State) error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("destroying project %s during CheckDestroy: %w", projectId, err)
|
||||
}
|
||||
_, err = wait.DeleteProjectWaitHandler(ctx, client, projectId).SetTimeout(15 * time.Minute).WaitWithContext(ctx)
|
||||
_, err = wait.DeleteProjectWaitHandler(ctx, client, projectId).WaitWithContext(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("destroying project %s during CheckDestroy: waiting for deletion %w", projectId, err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue