Skip to content

Commit ad70419

Browse files
committed
Remove commented code and add debug option to main
1 parent 84ad984 commit ad70419

File tree

2 files changed

+13
-35
lines changed

2 files changed

+13
-35
lines changed

main.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
package main
22

33
import (
4+
"flag"
5+
46
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
57
"github.com/terraform-providers/terraform-provider-postgresql/postgresql"
68
)
79

810
func main() {
9-
plugin.Serve(&plugin.ServeOpts{
10-
ProviderFunc: postgresql.Provider})
11+
var debug bool
12+
13+
flag.BoolVar(&debug, "debug", false, "set to true to run the provider with support for debuggers like delve")
14+
flag.Parse()
15+
16+
opts := &plugin.ServeOpts{
17+
Debug: debug,
18+
ProviderFunc: postgresql.Provider,
19+
ProviderAddr: "registry.terraform.io/cyrilgdn/postgresql",
20+
}
21+
plugin.Serve(opts)
1122
}

postgresql/resource_postgresql_security_label.go

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ func resourcePostgreSQLSecurityLabel() *schema.Resource {
2525
Read: PGResourceFunc(resourcePostgreSQLSecurityLabelRead),
2626
Update: PGResourceFunc(resourcePostgreSQLSecurityLabelUpdate),
2727
Delete: PGResourceFunc(resourcePostgreSQLSecurityLabelDelete),
28-
// Exists: PGResourceExistsFunc(resourcePostgreSQLSecurityLabelExists),
2928
Importer: &schema.ResourceImporter{
3029
StateContext: schema.ImportStatePassthroughContext,
3130
},
@@ -77,38 +76,6 @@ func resourcePostgreSQLSecurityLabelCreate(db *DBConnection, d *schema.ResourceD
7776
return resourcePostgreSQLSecurityLabelReadImpl(db, d)
7877
}
7978

80-
// func resourcePostgreSQLSecurityLabelExists(db *DBConnection, d *schema.ResourceData) (bool, error) {
81-
// if !db.featureSupported(featureSecurityLabel) {
82-
// return false, fmt.Errorf(
83-
// "Security Label is not supported for this Postgres version (%s)",
84-
// db.version,
85-
// )
86-
// }
87-
// log.Printf("[WARN] PostgreSQL security label Exists")
88-
89-
// id := strings.Split(d.Id(), ".")
90-
// if len(id) != 3 {
91-
// return false, fmt.Errorf(
92-
// "Invalid ID: %s. ID should be in the format of %s.%s.%s",
93-
// d.Id(),
94-
// securityLabelProviderAttr,
95-
// securityLabelObjectTypeAttr,
96-
// securityLabelObjectNameAttr,
97-
// )
98-
// }
99-
100-
// provider := id[0]
101-
// objectType := id[1]
102-
// objectName := id[2]
103-
// query := "SELECT objtype FROM pg_seclabels WHERE objtype = $1 and objname = $2 and provider = $3"
104-
// err := db.QueryRow(query, objectType, quoteIdentifier(objectName), quoteIdentifier(provider)).Scan(&objectType)
105-
// if err == sql.ErrNoRows || err != nil {
106-
// return false, err
107-
// }
108-
109-
// return true, nil
110-
// }
111-
11279
func resourcePostgreSQLSecurityLabelUpdateImpl(db *DBConnection, d *schema.ResourceData, label string) error {
11380
b := bytes.NewBufferString("SECURITY LABEL ")
11481

0 commit comments

Comments
 (0)