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 setting endpoint for EFS #4716

Merged
merged 1 commit into from
Jun 2, 2018
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
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 @@ -688,6 +688,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 @@ -795,6 +797,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 @@ -941,6 +944,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 @@ -1031,6 +1041,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