Skip to content

Commit a461715

Browse files
ewbankkitanGie44
authored andcommitted
d/aws_apigatewayv2_export: Fix 'Error: error exporting Gateway v2 API (o1hlpon70b): BadRequestException: No deployment is available in the stage tf-acc-test-5885592264819914276'.
1 parent deda445 commit a461715

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

internal/service/apigatewayv2/export_data_source_test.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,28 +77,33 @@ resource "aws_apigatewayv2_route" "test" {
7777
}
7878

7979
func testAccExportHTTPDataSourceBasicConfig(rName string) string {
80-
return testAccExportHTTPDataSourceConfigBase(rName) + `
80+
return acctest.ConfigCompose(testAccExportHTTPDataSourceConfigBase(rName), `
8181
data "aws_apigatewayv2_export" "test" {
8282
api_id = aws_apigatewayv2_route.test.api_id
8383
specification = "OAS30"
8484
output_type = "JSON"
8585
}
86-
`
86+
`)
8787
}
8888

8989
func testAccExportHTTPDataSourceStageConfig(rName string) string {
90-
return testAccExportHTTPDataSourceConfigBase(rName) + fmt.Sprintf(`
90+
return acctest.ConfigCompose(testAccExportHTTPDataSourceConfigBase(rName), fmt.Sprintf(`
9191
resource "aws_apigatewayv2_stage" "test" {
92+
api_id = aws_apigatewayv2_deployment.test.api_id
93+
name = %[1]q
94+
deployment_id = aws_apigatewayv2_deployment.test.id
95+
}
96+
97+
resource "aws_apigatewayv2_deployment" "test" {
9298
api_id = aws_apigatewayv2_route.test.api_id
93-
name = %[1]q
94-
auto_deploy = true
99+
description = %[1]q
95100
}
96101
97102
data "aws_apigatewayv2_export" "test" {
98-
api_id = aws_apigatewayv2_route.test.api_id
103+
api_id = aws_apigatewayv2_api.test.id
99104
specification = "OAS30"
100105
output_type = "JSON"
101106
stage_name = aws_apigatewayv2_stage.test.name
102107
}
103-
`, rName)
108+
`, rName))
104109
}

0 commit comments

Comments
 (0)