@@ -11,6 +11,7 @@ import (
1111
1212 "github.com/YakDriver/regexache"
1313 "github.com/aws/aws-sdk-go-v2/service/apigateway"
14+ awstypes "github.com/aws/aws-sdk-go-v2/service/apigateway/types"
1415 sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest"
1516 "github.com/hashicorp/terraform-plugin-testing/helper/resource"
1617 "github.com/hashicorp/terraform-plugin-testing/terraform"
@@ -582,6 +583,60 @@ func TestAccAPIGatewayIntegration_TLS_insecureSkipVerification(t *testing.T) {
582583 })
583584}
584585
586+ func TestAccAPIGatewayIntegration_responseTransferMode (t * testing.T ) {
587+ ctx := acctest .Context (t )
588+ var conf apigateway.GetIntegrationOutput
589+ rName := sdkacctest .RandomWithPrefix (acctest .ResourcePrefix )
590+ resourceName := "aws_api_gateway_integration.test"
591+
592+ resource .ParallelTest (t , resource.TestCase {
593+ PreCheck : func () { acctest .PreCheck (ctx , t ); acctest .PreCheckAPIGatewayTypeEDGE (t ) },
594+ ErrorCheck : acctest .ErrorCheck (t , names .APIGatewayServiceID ),
595+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories ,
596+ CheckDestroy : testAccCheckIntegrationDestroy (ctx ),
597+ Steps : []resource.TestStep {
598+ {
599+ Config : testAccIntegrationConfig_responseTransferMode (rName , string (awstypes .ResponseTransferModeStream )),
600+ Check : resource .ComposeTestCheckFunc (
601+ testAccCheckIntegrationExists (ctx , resourceName , & conf ),
602+ resource .TestCheckResourceAttr (resourceName , names .AttrType , "HTTP_PROXY" ),
603+ resource .TestCheckResourceAttr (resourceName , "integration_http_method" , "ANY" ),
604+ resource .TestCheckResourceAttr (resourceName , names .AttrURI , "https://example.com" ),
605+ resource .TestCheckResourceAttr (resourceName , "response_transfer_mode" , string (awstypes .ResponseTransferModeStream )),
606+ ),
607+ },
608+ {
609+ ResourceName : resourceName ,
610+ ImportState : true ,
611+ ImportStateIdFunc : testAccIntegrationImportStateIdFunc (resourceName ),
612+ ImportStateVerify : true ,
613+ },
614+ {
615+ // Switch to Buffered
616+ Config : testAccIntegrationConfig_responseTransferMode (rName , string (awstypes .ResponseTransferModeBuffered )),
617+ Check : resource .ComposeTestCheckFunc (
618+ testAccCheckIntegrationExists (ctx , resourceName , & conf ),
619+ resource .TestCheckResourceAttr (resourceName , names .AttrType , "HTTP_PROXY" ),
620+ resource .TestCheckResourceAttr (resourceName , "integration_http_method" , "ANY" ),
621+ resource .TestCheckResourceAttr (resourceName , names .AttrURI , "https://example.com" ),
622+ resource .TestCheckResourceAttr (resourceName , "response_transfer_mode" , string (awstypes .ResponseTransferModeBuffered )),
623+ ),
624+ },
625+ {
626+ // Switch back to Stream
627+ Config : testAccIntegrationConfig_responseTransferMode (rName , string (awstypes .ResponseTransferModeStream )),
628+ Check : resource .ComposeTestCheckFunc (
629+ testAccCheckIntegrationExists (ctx , resourceName , & conf ),
630+ resource .TestCheckResourceAttr (resourceName , names .AttrType , "HTTP_PROXY" ),
631+ resource .TestCheckResourceAttr (resourceName , "integration_http_method" , "ANY" ),
632+ resource .TestCheckResourceAttr (resourceName , names .AttrURI , "https://example.com" ),
633+ resource .TestCheckResourceAttr (resourceName , "response_transfer_mode" , string (awstypes .ResponseTransferModeStream )),
634+ ),
635+ },
636+ },
637+ })
638+ }
639+
585640func TestAccAPIGatewayIntegration_disappears (t * testing.T ) {
586641 ctx := acctest .Context (t )
587642 var conf apigateway.GetIntegrationOutput
@@ -1269,3 +1324,36 @@ resource "aws_api_gateway_integration" "test" {
12691324}
12701325` , rName , insecureSkipVerification )
12711326}
1327+
1328+ func testAccIntegrationConfig_responseTransferMode (rName , responseTransferMode string ) string {
1329+ return fmt .Sprintf (`
1330+ resource "aws_api_gateway_rest_api" "api" {
1331+ name = %[1]q
1332+ }
1333+
1334+ resource "aws_api_gateway_resource" "resource" {
1335+ path_part = "resource"
1336+ parent_id = aws_api_gateway_rest_api.api.root_resource_id
1337+ rest_api_id = aws_api_gateway_rest_api.api.id
1338+ }
1339+
1340+ resource "aws_api_gateway_method" "method" {
1341+ rest_api_id = aws_api_gateway_rest_api.api.id
1342+ resource_id = aws_api_gateway_resource.resource.id
1343+ http_method = "ANY"
1344+ authorization = "NONE"
1345+ }
1346+
1347+ resource "aws_api_gateway_integration" "test" {
1348+ rest_api_id = aws_api_gateway_rest_api.api.id
1349+ resource_id = aws_api_gateway_resource.resource.id
1350+ http_method = aws_api_gateway_method.method.http_method
1351+ integration_http_method = "ANY"
1352+ type = "HTTP_PROXY"
1353+ uri = "https://example.com"
1354+
1355+ response_transfer_mode = %[2]q
1356+ }
1357+
1358+ ` , rName , responseTransferMode )
1359+ }
0 commit comments