hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.74k stars 9.1k forks source link

[Enhancement]: no_redirect flag for Storage Gateway activation #30152

Open david-forster10 opened 1 year ago

david-forster10 commented 1 year ago

Description

While working in a closed network, trying to activate the Storage Gateway is failing due to a ClientTimeout when the API call redirects to the external AWS endpoints. When manually using the "no_redirect" option in the activation call, I am presented with an activation token without error.

Failing activation address due to redirect: http://xxx.xxx.xxx.xxx/?activationRegion=eu-west-2&vpcEndpoint=vpce-xxxxxxxxxxxxxxx-xxxxxx.storagegateway.eu-west-2.vpce.amazonaws.com

Successful activation address with using the no_redirect flag: http://xxx.xxx.xxx.xxx/?activationRegion=eu-west-2&vpcEndpoint=vpce-xxxxxxxxxxxxxxx-xxxxxx.storagegateway.eu-west-2.vpce.amazonaws.com&no_redirect

By allowing the inclusion of the no_redirect flag improves automation compatibility for systems in closed networks.

Affected Resource(s) and/or Data Source(s)

aws_storagegateway_gateway

Potential Terraform Configuration

resource "aws_storagegateway_gateway" "s3_gateway" {
  gateway_name         = "S3-Gateway"
  gateway_timezone     = "GMT"
  gateway_type         = "FILE_S3"
  gateway_ip_address   = 1.2.3.4
  gateway_vpc_endpoint = "vpce-xxxxxxxxxxxxxxx-xxxxxx.storagegateway.eu-west-2.vpce.amazonaws.com"
  no_redirect          = true
}

References

no_redirect flag is mentioned in "Deploying the solution" - Step 3 from the following aws blog post: https://aws.amazon.com/blogs/storage/mounting-amazon-s3-to-an-amazon-ec2-instance-using-a-private-connection-to-s3-file-gateway/

The no_redirect flag is also referred to under the Linux (curl) documentation here: https://docs.aws.amazon.com/storagegateway/latest/vgw/get-activation-key.html

Would you like to implement a fix?

No

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

DrFaust92 commented 1 year ago

@david-forster10 have you tried appending no_redirect to gateway_vpc_endpoint value?

david-forster10 commented 1 year ago

Apologies for the delay on responding, appending the no_redirect value results in an error as the module is programmed to expect the 302 redirect response:

expected HTTP status code 302, received: 200