|
1 | 1 | package scaleway
|
2 | 2 |
|
3 | 3 | import (
|
4 |
| - "bytes" |
5 | 4 | "encoding/json"
|
6 | 5 | "fmt"
|
7 | 6 | "net"
|
8 | 7 | "net/http"
|
9 | 8 | "regexp"
|
10 | 9 | "strings"
|
11 |
| - "text/template" |
12 | 10 | "time"
|
13 | 11 |
|
14 |
| - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" |
15 | 12 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
16 |
| - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" |
17 | 13 | "github.com/scaleway/scaleway-sdk-go/namegenerator"
|
18 | 14 | "github.com/scaleway/scaleway-sdk-go/scw"
|
19 | 15 | "golang.org/x/xerrors"
|
@@ -302,37 +298,6 @@ func isUUID(s string) bool {
|
302 | 298 | return UUIDRegex.MatchString(s)
|
303 | 299 | }
|
304 | 300 |
|
305 |
| -// newTemplateFunc takes a go template string and returns a function that can be called to execute template. |
306 |
| -func newTemplateFunc(tplStr string) func(data interface{}) string { |
307 |
| - t := template.Must(template.New("tpl").Parse(tplStr)) |
308 |
| - return func(tplParams interface{}) string { |
309 |
| - buffer := bytes.Buffer{} |
310 |
| - err := t.Execute(&buffer, tplParams) |
311 |
| - if err != nil { |
312 |
| - panic(err) // lintignore:R009 |
313 |
| - } |
314 |
| - return buffer.String() |
315 |
| - } |
316 |
| -} |
317 |
| - |
318 |
| -// testAccGetResourceAttr can be used in acceptance tests to extract value from state and store it in dest |
319 |
| -func testAccGetResourceAttr(resourceName string, attrName string, dest *string) resource.TestCheckFunc { |
320 |
| - return func(state *terraform.State) error { |
321 |
| - r, exist := state.RootModule().Resources[resourceName] |
322 |
| - if !exist { |
323 |
| - return fmt.Errorf("unknown ressource %s", resourceName) |
324 |
| - } |
325 |
| - |
326 |
| - a, exist := r.Primary.Attributes[attrName] |
327 |
| - if !exist { |
328 |
| - return fmt.Errorf("unknown ressource %s", resourceName) |
329 |
| - } |
330 |
| - |
331 |
| - *dest = a |
332 |
| - return nil |
333 |
| - } |
334 |
| -} |
335 |
| - |
336 | 301 | func flattenTime(date *time.Time) interface{} {
|
337 | 302 | if date != nil {
|
338 | 303 | return date.Format(time.RFC3339)
|
|
0 commit comments