Skip to content

Commit

Permalink
Merge pull request #4716 from joseph-stratoscale/efs_endpoint
Browse files Browse the repository at this point in the history
Allow setting endpoint for EFS
  • Loading branch information
bflad authored Jun 2, 2018
2 parents c72223f + d53b1c2 commit cbba829
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion aws/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ type Config struct {
Ec2Endpoint string
EcsEndpoint string
EcrEndpoint string
EfsEndpoint string
EsEndpoint string
ElbEndpoint string
IamEndpoint string
Expand Down Expand Up @@ -389,6 +390,7 @@ func (c *Config) Client() (interface{}, error) {
awsEc2Sess := sess.Copy(&aws.Config{Endpoint: aws.String(c.Ec2Endpoint)})
awsEcrSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.EcrEndpoint)})
awsEcsSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.EcsEndpoint)})
awsEfsSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.EfsEndpoint)})
awsElbSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.ElbEndpoint)})
awsEsSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.EsEndpoint)})
awsIamSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.IamEndpoint)})
Expand Down Expand Up @@ -473,7 +475,7 @@ func (c *Config) Client() (interface{}, error) {
client.dynamodbconn = dynamodb.New(awsDynamoSess)
client.ecrconn = ecr.New(awsEcrSess)
client.ecsconn = ecs.New(awsEcsSess)
client.efsconn = efs.New(sess)
client.efsconn = efs.New(awsEfsSess)
client.elasticacheconn = elasticache.New(sess)
client.elasticbeanstalkconn = elasticbeanstalk.New(sess)
client.elastictranscoderconn = elastictranscoder.New(sess)
Expand Down
11 changes: 11 additions & 0 deletions aws/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,8 @@ func init() {

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

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

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

"es_endpoint": "Use this to override the default endpoint URL constructed from the `region`.\n",
Expand Down Expand Up @@ -798,6 +800,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
config.Ec2Endpoint = endpoints["ec2"].(string)
config.EcrEndpoint = endpoints["ecr"].(string)
config.EcsEndpoint = endpoints["ecs"].(string)
config.EfsEndpoint = endpoints["efs"].(string)
config.ElbEndpoint = endpoints["elb"].(string)
config.EsEndpoint = endpoints["es"].(string)
config.IamEndpoint = endpoints["iam"].(string)
Expand Down Expand Up @@ -944,6 +947,13 @@ func endpointsSchema() *schema.Schema {
Description: descriptions["ecs_endpoint"],
},

"efs": {
Type: schema.TypeString,
Optional: true,
Default: "",
Description: descriptions["efs_endpoint"],
},

"elb": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -1034,6 +1044,7 @@ func endpointsToHash(v interface{}) int {
buf.WriteString(fmt.Sprintf("%s-", m["dynamodb"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["iam"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["ec2"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["efs"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["elb"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["kinesis"].(string)))
buf.WriteString(fmt.Sprintf("%s-", m["kms"].(string)))
Expand Down
4 changes: 4 additions & 0 deletions website/docs/index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ Nested `endpoints` block supports the following:
URL constructed from the `region`. It's typically used to connect to
custom ELB endpoints.

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

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

0 comments on commit cbba829

Please sign in to comment.