-
Notifications
You must be signed in to change notification settings - Fork 258
Add extra connection host for AWS RDS IAM token #489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
6da51a3
43d5e8d
bc9e0c3
ba3d079
40eb932
72dd06e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,10 @@ package postgresql | |
import ( | ||
"context" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/aws/aws-sdk-go-v2/credentials" | ||
"github.com/aws/aws-sdk-go-v2/service/sts" | ||
"os" | ||
|
||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" | ||
"github.com/Azure/azure-sdk-for-go/sdk/azidentity" | ||
|
@@ -40,6 +41,12 @@ func Provider() *schema.Provider { | |
}, false), | ||
}, | ||
"host": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
DefaultFunc: schema.EnvDefaultFunc("PGHOST", nil), | ||
Description: "Name of PostgreSQL server address", | ||
}, | ||
"connection_host": { | ||
|
||
Type: schema.TypeString, | ||
Optional: true, | ||
DefaultFunc: schema.EnvDefaultFunc("PGHOST", nil), | ||
|
@@ -343,6 +350,11 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) { | |
port := d.Get("port").(int) | ||
username := d.Get("username").(string) | ||
|
||
connectionHost := d.Get("connection_host").(string) | ||
if connectionHost == "" { | ||
connectionHost = host | ||
} | ||
|
||
var password string | ||
if d.Get("aws_rds_iam_auth").(bool) { | ||
profile := d.Get("aws_rds_iam_profile").(string) | ||
|
@@ -370,6 +382,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) { | |
config := Config{ | ||
Scheme: d.Get("scheme").(string), | ||
Host: host, | ||
ConnectionHost: connectionHost, | ||
Port: port, | ||
Username: username, | ||
Password: password, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would revert this change, I feel "to connect to" is useful in distinguishing the difference between the options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done