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

provider: Add HTTP proxy setting #21077

Merged
merged 3 commits into from
Sep 29, 2021
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
3 changes: 3 additions & 0 deletions .changelog/21077.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
provider: Add parameter `http_proxy` to provider configuration
```
2 changes: 2 additions & 0 deletions aws/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ type Config struct {
Endpoints map[string]string
IgnoreTagsConfig *keyvaluetags.IgnoreConfig
Insecure bool
HTTPProxy string

SkipCredsValidation bool
SkipGetEC2Platforms bool
Expand Down Expand Up @@ -435,6 +436,7 @@ func (c *Config) Client() (interface{}, error) {
DebugLogging: logging.IsDebugOrHigher(),
IamEndpoint: c.Endpoints["iam"],
Insecure: c.Insecure,
HTTPProxy: c.HTTPProxy,
MaxRetries: c.MaxRetries,
Profile: c.Profile,
Region: c.Region,
Expand Down
12 changes: 11 additions & 1 deletion aws/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ func Provider() *schema.Provider {
},
},

"http_proxy": {
Type: schema.TypeString,
Optional: true,
Description: descriptions["http_proxy"],
},

"endpoints": endpointsSchema(),

"ignore_tags": {
Expand Down Expand Up @@ -1325,9 +1331,12 @@ func init() {
"being executed. If the API request still fails, an error is\n" +
"thrown.",

"http_proxy": "The address of an HTTP proxy to use when accessing the AWS API. " +
"Can also be configured using the `HTTP_PROXY` or `HTTPS_PROXY` environment variables.",

"endpoint": "Use this to override the default service endpoint URL",

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

"skip_credentials_validation": "Skip the credentials validation via STS API. " +
Expand Down Expand Up @@ -1529,6 +1538,7 @@ func providerConfigure(d *schema.ResourceData, terraformVersion string) (interfa
MaxRetries: d.Get("max_retries").(int),
IgnoreTagsConfig: expandProviderIgnoreTags(d.Get("ignore_tags").([]interface{})),
Insecure: d.Get("insecure").(bool),
HTTPProxy: d.Get("http_proxy").(string),
SkipCredsValidation: d.Get("skip_credentials_validation").(bool),
SkipGetEC2Platforms: d.Get("skip_get_ec2_platforms").(bool),
SkipRegionValidation: d.Get("skip_region_validation").(bool),
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/aws/aws-sdk-go v1.40.50
github.com/beevik/etree v1.1.0
github.com/fatih/color v1.9.0 // indirect
github.com/hashicorp/aws-sdk-go-base v0.7.1
github.com/hashicorp/aws-sdk-go-base v1.0.0
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/go-multierror v1.1.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/hashicorp/aws-sdk-go-base v0.7.1 h1:7s/aR3hFn74tYPVihzDyZe7y/+BorN70rr9ZvpV3j3o=
github.com/hashicorp/aws-sdk-go-base v0.7.1/go.mod h1:2fRjWDv3jJBeN6mVWFHV6hFTNeFBx2gpDLQaZNxUVAY=
github.com/hashicorp/aws-sdk-go-base v1.0.0 h1:J7MMLOfSoDWkusy+cSzKYG1/aFyCzYJmdE0mod3/WLw=
github.com/hashicorp/aws-sdk-go-base v1.0.0/go.mod h1:2fRjWDv3jJBeN6mVWFHV6hFTNeFBx2gpDLQaZNxUVAY=
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU=
Expand Down
3 changes: 3 additions & 0 deletions website/docs/index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ In addition to [generic `provider` arguments](https://www.terraform.io/docs/conf
* `assume_role` - (Optional) An `assume_role` block (documented below). Only one
`assume_role` block may be in the configuration.

* `http_proxy` - (Optional) The address of an HTTP proxy to use when accessing the AWS API.
Can also be configured using the `HTTP_PROXY` or `HTTPS_PROXY` environment variables.

* `endpoints` - (Optional) Configuration block for customizing service endpoints. See the
[Custom Service Endpoints Guide](/docs/providers/aws/guides/custom-service-endpoints.html)
for more information about connecting to alternate AWS endpoints or AWS compatible solutions.
Expand Down