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

added support for custom endpoint for SSM #4670

Merged
merged 1 commit into from
May 29, 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 @@ -136,6 +136,7 @@ type Config struct {
SnsEndpoint string
SqsEndpoint string
StsEndpoint string
SsmEndpoint string
Insecure bool

SkipCredsValidation bool
Expand Down Expand Up @@ -400,6 +401,7 @@ func (c *Config) Client() (interface{}, error) {
awsSqsSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.SqsEndpoint)})
awsStsSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.StsEndpoint)})
awsDeviceFarmSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.DeviceFarmEndpoint)})
awsSsmSess := sess.Copy(&aws.Config{Endpoint: aws.String(c.SsmEndpoint)})

log.Println("[INFO] Initializing DeviceFarm SDK connection")
client.devicefarmconn = devicefarm.New(awsDeviceFarmSess)
Expand Down Expand Up @@ -506,7 +508,7 @@ func (c *Config) Client() (interface{}, error) {
client.sfnconn = sfn.New(sess)
client.snsconn = sns.New(awsSnsSess)
client.sqsconn = sqs.New(awsSqsSess)
client.ssmconn = ssm.New(sess)
client.ssmconn = ssm.New(awsSsmSess)
client.wafconn = waf.New(sess)
client.wafregionalconn = wafregional.New(sess)
client.batchconn = batch.New(sess)
Expand Down
9 changes: 9 additions & 0 deletions aws/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,8 @@ func init() {

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

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

"insecure": "Explicitly allow the provider to perform \"insecure\" SSL requests. If omitted," +
"default value is `false`",

Expand Down Expand Up @@ -804,6 +806,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
config.SnsEndpoint = endpoints["sns"].(string)
config.SqsEndpoint = endpoints["sqs"].(string)
config.StsEndpoint = endpoints["sts"].(string)
config.SsmEndpoint = endpoints["ssm"].(string)
}

if v, ok := d.GetOk("allowed_account_ids"); ok {
Expand Down Expand Up @@ -1003,6 +1006,12 @@ func endpointsSchema() *schema.Schema {
Default: "",
Description: descriptions["sts_endpoint"],
},
"ssm": {
Type: schema.TypeString,
Optional: true,
Default: "",
Description: descriptions["ssm_endpoint"],
},
},
},
Set: endpointsToHash,
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 @@ -343,6 +343,10 @@ Nested `endpoints` block supports the following:
URL constructed from the `region`. It's typically used to connect to
custom STS endpoints.

* `ssm` - (Optional) Use this to override the default endpoint
URL constructed from the `region`. It's typically used to connect to
custom STS endpoints.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor typo -- which I'll fix on merge

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cheers :) 👍


## Getting the Account ID

If you use either `allowed_account_ids` or `forbidden_account_ids`,
Expand Down