Skip to content

Commit

Permalink
r/aws_apigatewayv2_integration: Different range of valid values and d…
Browse files Browse the repository at this point in the history
…efaults for 'timeout_milliseconds' between HTTP and WebSocket APIs.
  • Loading branch information
ewbankkit committed Nov 4, 2020
1 parent 78b3139 commit caa31be
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
7 changes: 3 additions & 4 deletions aws/resource_aws_apigatewayv2_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,9 @@ func resourceAwsApiGatewayV2Integration() *schema.Resource {
Optional: true,
},
"timeout_milliseconds": {
Type: schema.TypeInt,
Optional: true,
Default: 29000,
ValidateFunc: validation.IntBetween(50, 29000),
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"tls_config": {
Type: schema.TypeList,
Expand Down
25 changes: 12 additions & 13 deletions aws/resource_aws_apigatewayv2_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestAccAWSAPIGatewayV2Integration_basicHttp(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "payload_format_version", "1.0"),
resource.TestCheckResourceAttr(resourceName, "request_templates.%", "0"),
resource.TestCheckResourceAttr(resourceName, "template_selection_expression", ""),
resource.TestCheckResourceAttr(resourceName, "timeout_milliseconds", "29000"),
resource.TestCheckResourceAttr(resourceName, "timeout_milliseconds", "30000"),
),
},
{
Expand Down Expand Up @@ -267,7 +267,7 @@ func TestAccAWSAPIGatewayV2Integration_LambdaHttp(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "request_parameters.%", "0"),
resource.TestCheckResourceAttr(resourceName, "request_templates.%", "0"),
resource.TestCheckResourceAttr(resourceName, "template_selection_expression", ""),
resource.TestCheckResourceAttr(resourceName, "timeout_milliseconds", "29000"),
resource.TestCheckResourceAttr(resourceName, "timeout_milliseconds", "30000"),
resource.TestCheckResourceAttr(resourceName, "tls_config.#", "0"),
),
},
Expand Down Expand Up @@ -357,7 +357,7 @@ func TestAccAWSAPIGatewayV2Integration_VpcLinkHttp(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "payload_format_version", "1.0"),
resource.TestCheckResourceAttr(resourceName, "request_templates.%", "0"),
resource.TestCheckResourceAttr(resourceName, "template_selection_expression", ""),
resource.TestCheckResourceAttr(resourceName, "timeout_milliseconds", "5001"),
resource.TestCheckResourceAttr(resourceName, "timeout_milliseconds", "29001"),
resource.TestCheckResourceAttr(resourceName, "tls_config.#", "1"),
resource.TestCheckResourceAttr(resourceName, "tls_config.0.server_name_to_verify", "www.example.com"),
),
Expand Down Expand Up @@ -386,7 +386,7 @@ func TestAccAWSAPIGatewayV2Integration_VpcLinkHttp(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "payload_format_version", "1.0"),
resource.TestCheckResourceAttr(resourceName, "request_templates.%", "0"),
resource.TestCheckResourceAttr(resourceName, "template_selection_expression", ""),
resource.TestCheckResourceAttr(resourceName, "timeout_milliseconds", "4999"),
resource.TestCheckResourceAttr(resourceName, "timeout_milliseconds", "29001"),
resource.TestCheckResourceAttr(resourceName, "tls_config.#", "1"),
resource.TestCheckResourceAttr(resourceName, "tls_config.0.server_name_to_verify", "www.example.org"),
),
Expand Down Expand Up @@ -436,7 +436,7 @@ func TestAccAWSAPIGatewayV2Integration_AwsServiceIntegration(t *testing.T) {
resource.TestCheckResourceAttrPair(resourceName, "request_parameters.QueueUrl", sqsQueue1ResourceName, "id"),
resource.TestCheckResourceAttr(resourceName, "request_templates.%", "0"),
resource.TestCheckResourceAttr(resourceName, "template_selection_expression", ""),
resource.TestCheckResourceAttr(resourceName, "timeout_milliseconds", "29000"),
resource.TestCheckResourceAttr(resourceName, "timeout_milliseconds", "30000"),
resource.TestCheckResourceAttr(resourceName, "tls_config.#", "0"),
),
},
Expand All @@ -461,7 +461,7 @@ func TestAccAWSAPIGatewayV2Integration_AwsServiceIntegration(t *testing.T) {
resource.TestCheckResourceAttrPair(resourceName, "request_parameters.QueueUrl", sqsQueue2ResourceName, "id"),
resource.TestCheckResourceAttr(resourceName, "request_templates.%", "0"),
resource.TestCheckResourceAttr(resourceName, "template_selection_expression", ""),
resource.TestCheckResourceAttr(resourceName, "timeout_milliseconds", "29000"),
resource.TestCheckResourceAttr(resourceName, "timeout_milliseconds", "30000"),
resource.TestCheckResourceAttr(resourceName, "tls_config.#", "0"),
),
},
Expand Down Expand Up @@ -800,7 +800,7 @@ resource "aws_apigatewayv2_integration" "test" {
description = "Test private integration"
integration_method = "GET"
integration_uri = aws_lb_listener.test.arn
timeout_milliseconds = 5001
timeout_milliseconds = 29001
tls_config {
server_name_to_verify = "www.example.com"
Expand All @@ -817,12 +817,11 @@ resource "aws_apigatewayv2_integration" "test" {
api_id = aws_apigatewayv2_api.test.id
integration_type = "HTTP_PROXY"
connection_type = "VPC_LINK"
connection_id = aws_apigatewayv2_vpc_link.test.id
description = "Test private integration updated"
integration_method = "POST"
integration_uri = aws_lb_listener.test.arn
timeout_milliseconds = 4999
connection_type = "VPC_LINK"
connection_id = aws_apigatewayv2_vpc_link.test.id
description = "Test private integration updated"
integration_method = "POST"
integration_uri = aws_lb_listener.test.arn
tls_config {
server_name_to_verify = "www.example.org"
Expand Down
4 changes: 3 additions & 1 deletion website/docs/r/apigatewayv2_integration.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ Valid values: `WHEN_NO_MATCH`, `WHEN_NO_TEMPLATES`, `NEVER`. Default is `WHEN_NO
Supported only for WebSocket APIs.
* `request_templates` - (Optional) A map of Velocity templates that are applied on the request payload based on the value of the Content-Type header sent by the client. Supported only for WebSocket APIs.
* `template_selection_expression` - (Optional) The [template selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-template-selection-expressions) for the integration.
* `timeout_milliseconds` - (Optional) Custom timeout between 50 and 29,000 milliseconds. The default value is 29,000 milliseconds or 29 seconds.
* `timeout_milliseconds` - (Optional) Custom timeout between 50 and 29,000 milliseconds for WebSocket APIs and between 50 and 30,000 milliseconds for HTTP APIs.
The default timeout is 29 seconds for WebSocket APIs and 30 seconds for HTTP APIs.
Terraform will only perform drift detection of its value when present in a configuration.
* `tls_config` - (Optional) The TLS configuration for a private integration. Supported only for HTTP APIs.

The `tls_config` object supports the following:
Expand Down

0 comments on commit caa31be

Please sign in to comment.