@@ -11,7 +11,7 @@ import (
1111 "github.com/hashicorp/terraform-plugin-sdk/terraform"
1212)
1313
14- func TestAccAWSAPIGatewayV2Integration_basic (t * testing.T ) {
14+ func TestAccAWSAPIGatewayV2Integration_basicWebSocket (t * testing.T ) {
1515 var apiId string
1616 var v apigatewayv2.GetIntegrationOutput
1717 resourceName := "aws_apigatewayv2_integration.test"
@@ -52,6 +52,47 @@ func TestAccAWSAPIGatewayV2Integration_basic(t *testing.T) {
5252 })
5353}
5454
55+ func TestAccAWSAPIGatewayV2Integration_basicHttp (t * testing.T ) {
56+ var apiId string
57+ var v apigatewayv2.GetIntegrationOutput
58+ resourceName := "aws_apigatewayv2_integration.test"
59+ rName := acctest .RandomWithPrefix ("tf-acc-test" )
60+
61+ resource .ParallelTest (t , resource.TestCase {
62+ PreCheck : func () { testAccPreCheck (t ) },
63+ Providers : testAccProviders ,
64+ CheckDestroy : testAccCheckAWSAPIGatewayV2IntegrationDestroy ,
65+ Steps : []resource.TestStep {
66+ {
67+ Config : testAccAWSAPIGatewayV2IntegrationConfig_httpProxy (rName ),
68+ Check : resource .ComposeTestCheckFunc (
69+ testAccCheckAWSAPIGatewayV2IntegrationExists (resourceName , & apiId , & v ),
70+ resource .TestCheckResourceAttr (resourceName , "connection_id" , "" ),
71+ resource .TestCheckResourceAttr (resourceName , "connection_type" , "INTERNET" ),
72+ resource .TestCheckResourceAttr (resourceName , "content_handling_strategy" , "" ),
73+ resource .TestCheckResourceAttr (resourceName , "credentials_arn" , "" ),
74+ resource .TestCheckResourceAttr (resourceName , "description" , "" ),
75+ resource .TestCheckResourceAttr (resourceName , "integration_method" , "GET" ),
76+ resource .TestCheckResourceAttr (resourceName , "integration_response_selection_expression" , "" ),
77+ resource .TestCheckResourceAttr (resourceName , "integration_type" , "HTTP_PROXY" ),
78+ resource .TestCheckResourceAttr (resourceName , "integration_uri" , "https://example.com" ),
79+ resource .TestCheckResourceAttr (resourceName , "passthrough_behavior" , "" ),
80+ resource .TestCheckResourceAttr (resourceName , "payload_format_version" , "1.0" ),
81+ resource .TestCheckResourceAttr (resourceName , "request_templates.%" , "0" ),
82+ resource .TestCheckResourceAttr (resourceName , "template_selection_expression" , "" ),
83+ resource .TestCheckResourceAttr (resourceName , "timeout_milliseconds" , "29000" ),
84+ ),
85+ },
86+ {
87+ ResourceName : resourceName ,
88+ ImportStateIdFunc : testAccAWSAPIGatewayV2IntegrationImportStateIdFunc (resourceName ),
89+ ImportState : true ,
90+ ImportStateVerify : true ,
91+ },
92+ },
93+ })
94+ }
95+
5596func TestAccAWSAPIGatewayV2Integration_disappears (t * testing.T ) {
5697 var apiId string
5798 var v apigatewayv2.GetIntegrationOutput
@@ -311,6 +352,15 @@ resource "aws_apigatewayv2_api" "test" {
311352` , rName )
312353}
313354
355+ func testAccAWSAPIGatewayV2IntegrationConfig_apiHttp (rName string ) string {
356+ return fmt .Sprintf (`
357+ resource "aws_apigatewayv2_api" "test" {
358+ name = %[1]q
359+ protocol_type = "HTTP"
360+ }
361+ ` , rName )
362+ }
363+
314364func testAccAWSAPIGatewayV2IntegrationConfig_basic (rName string ) string {
315365 return testAccAWSAPIGatewayV2IntegrationConfig_apiWebSocket (rName ) + `
316366resource "aws_apigatewayv2_integration" "test" {
@@ -392,6 +442,18 @@ resource "aws_apigatewayv2_integration" "test" {
392442` , rName )
393443}
394444
445+ func testAccAWSAPIGatewayV2IntegrationConfig_httpProxy (rName string ) string {
446+ return testAccAWSAPIGatewayV2IntegrationConfig_apiHttp (rName ) + fmt .Sprintf (`
447+ resource "aws_apigatewayv2_integration" "test" {
448+ api_id = "${aws_apigatewayv2_api.test.id}"
449+ integration_type = "HTTP_PROXY"
450+
451+ integration_method = "GET"
452+ integration_uri = "https://example.com"
453+ }
454+ ` )
455+ }
456+
395457func testAccAWSAPIGatewayV2IntegrationConfig_vpcLink (rName string ) string {
396458 return testAccAWSAPIGatewayV2IntegrationConfig_apiWebSocket (rName ) + fmt .Sprintf (`
397459data "aws_availability_zones" "available" {
0 commit comments