Skip to content
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

Allow overriding firehose and redshift endpoints #8007

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions aws/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,14 @@ type Config struct {
EfsEndpoint string
EsEndpoint string
ElbEndpoint string
FirehoseEndpoint string
IamEndpoint string
KinesisEndpoint string
KinesisAnalyticsEndpoint string
KmsEndpoint string
LambdaEndpoint string
RdsEndpoint string
RedshiftEndpoint string
R53Endpoint string
S3Endpoint string
S3ControlEndpoint string
Expand Down Expand Up @@ -405,7 +407,7 @@ func (c *Config) Client() (interface{}, error) {
elbv2conn: elbv2.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.ElbEndpoint)})),
emrconn: emr.New(sess),
esconn: elasticsearch.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.EsEndpoint)})),
firehoseconn: firehose.New(sess),
firehoseconn: firehose.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.FirehoseEndpoint)})),
fmsconn: fms.New(sess),
fsxconn: fsx.New(sess),
gameliftconn: gamelift.New(sess),
Expand Down Expand Up @@ -442,7 +444,7 @@ func (c *Config) Client() (interface{}, error) {
r53conn: route53.New(sess.Copy(&aws.Config{Region: aws.String("us-east-1"), Endpoint: aws.String(c.R53Endpoint)})),
ramconn: ram.New(sess),
rdsconn: rds.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.RdsEndpoint)})),
redshiftconn: redshift.New(sess),
redshiftconn: redshift.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.RedshiftEndpoint)})),
region: c.Region,
resourcegroupsconn: resourcegroups.New(sess),
route53resolverconn: route53resolver.New(sess),
Expand Down
20 changes: 20 additions & 0 deletions aws/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,8 @@ func init() {
"dynamodb_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n" +
"It's typically used to connect to dynamodb-local.",

"firehose_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n",

"kinesis_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n" +
"It's typically used to connect to kinesalite.",

Expand All @@ -836,6 +838,8 @@ func init() {

"rds_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n",

"redshift_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n",

"s3_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n",

"s3control_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n",
Expand Down Expand Up @@ -945,13 +949,15 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
config.EfsEndpoint = endpoints["efs"].(string)
config.ElbEndpoint = endpoints["elb"].(string)
config.EsEndpoint = endpoints["es"].(string)
config.FirehoseEndpoint = endpoints["firehose"].(string)
config.IamEndpoint = endpoints["iam"].(string)
config.KinesisEndpoint = endpoints["kinesis"].(string)
config.KinesisAnalyticsEndpoint = endpoints["kinesis_analytics"].(string)
config.KmsEndpoint = endpoints["kms"].(string)
config.LambdaEndpoint = endpoints["lambda"].(string)
config.R53Endpoint = endpoints["r53"].(string)
config.RdsEndpoint = endpoints["rds"].(string)
config.RedshiftEndpoint = endpoints["redshift"].(string)
config.S3Endpoint = endpoints["s3"].(string)
config.S3ControlEndpoint = endpoints["s3control"].(string)
config.SesEndpoint = endpoints["ses"].(string)
Expand Down Expand Up @@ -1122,6 +1128,12 @@ func endpointsSchema() *schema.Schema {
Default: "",
Description: descriptions["es_endpoint"],
},
"firehose": {
Type: schema.TypeString,
Optional: true,
Default: "",
Description: descriptions["firehose_endpoint"],
},
"kinesis": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -1158,6 +1170,12 @@ func endpointsSchema() *schema.Schema {
Default: "",
Description: descriptions["rds_endpoint"],
},
"redshift": {
Type: schema.TypeString,
Optional: true,
Default: "",
Description: descriptions["redshift_endpoint"],
},
"s3": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -1221,10 +1239,12 @@ func endpointsToHash(v interface{}) int {
buf.WriteString(fmt.Sprintf("%s-", m["autoscaling"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["efs"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["elb"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["firehose"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["kinesis"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["kms"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["lambda"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["rds"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["redshift"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["s3"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["ses"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["sns"].(string)))
Expand Down
8 changes: 8 additions & 0 deletions website/docs/index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,10 @@ Nested `endpoints` block supports the following:
URL constructed from the `region`. It's typically used to connect to
custom Elasticsearch endpoints.

* `firehose` - (Optional) Use this to override the default endpoint
URL constructed from the `region`. It's typically used to connect to
custom Firehose endpoints.

* `iam` - (Optional) Use this to override the default endpoint
URL constructed from the `region`. It's typically used to connect to
custom IAM endpoints.
Expand All @@ -368,6 +372,10 @@ Nested `endpoints` block supports the following:
URL constructed from the `region`. It's typically used to connect to
custom RDS endpoints.

* `redshift` - (Optional) Use this to override the default endpoint
URL constructed from the `region`. It's typically used to connect to
custom Redshift endpoints.

* `s3` - (Optional) Use this to override the default endpoint
URL constructed from the `region`. It's typically used to connect to
custom S3 endpoints.
Expand Down