outputs.tf
1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
output "api_gateway_url" {
description = "API Gateway invocation URL"
value = "${aws_apigatewayv2_api.user_management.api_endpoint}/${aws_apigatewayv2_stage.production.name}"
}
output "nlb_dns_name" {
description = "Network Load Balancer DNS name"
value = data.aws_lb.nlb.dns_name
}
output "api_gateway_id" {
description = "API Gateway ID"
value = aws_apigatewayv2_api.user_management.id
}
output "vpc_link_id" {
description = "VPC Link ID"
value = aws_apigatewayv2_vpc_link.user_management.id
}
output "cloudwatch_log_group" {
description = "CloudWatch Log Group for API Gateway"
value = aws_cloudwatch_log_group.api_gateway.name
}
output "waf_web_acl_arn" {
description = "WAF Web ACL ARN"
value = var.create_waf ? aws_wafv2_web_acl.api_gateway[0].arn : null
}
# 有用的测试命令
output "test_commands" {
description = "Useful test commands"
value = {
test_root = "curl ${aws_apigatewayv2_api.user_management.api_endpoint}/${aws_apigatewayv2_stage.production.name}/"
test_health = "curl ${aws_apigatewayv2_api.user_management.api_endpoint}/${aws_apigatewayv2_stage.production.name}/api/health"
test_users = "curl ${aws_apigatewayv2_api.user_management.api_endpoint}/${aws_apigatewayv2_stage.production.name}/api/users"
create_user = "curl -X POST ${aws_apigatewayv2_api.user_management.api_endpoint}/${aws_apigatewayv2_stage.production.name}/api/users -H 'Content-Type: application/json' -d '{\"username\":\"test\",\"name\":\"Test User\",\"email\":\"test@example.com\",\"password\":\"123456\",\"phone\":\"13800138000\"}'"
}
}