寻找对 `UserConfigResponseModel` 的修改以声明正确的 `aws_api_gateway_method_response` 资源
Looking for Modification to `UserConfigResponseModel` To Declare a Correct `aws_api_gateway_method_response` resource
Reading this document for how to setup an AWS Transfer Family SFTP server 指定您需要 application/json UserConfigResponseModel
方法响应类型。通过 Web 控制台设置时,这是一种可能的配置
但是当我尝试在 Terraform 中创建相同的配置时,我遇到了
Error: Error creating API Gateway Method Response: BadRequestException: Invalid model identifier specified: UserConfigResponseModel
on ../../../../module/data-platform-sftp/api_gateway.tf line 53, in resource "aws_api_gateway_method_response" "status_200":
53: resource "aws_api_gateway_method_response" "status_200" {
地形声明为
resource "aws_api_gateway_method_response" "status_200" {
rest_api_id = aws_api_gateway_rest_api.reconciliation_auth.id
resource_id = aws_api_gateway_resource.config_path.id
http_method = aws_api_gateway_method.config_get.http_method
status_code = "200"
response_models = {
"application/json" = "UserConfigResponseModel"
}
}
我想知道是否有可能找到所有有效的模型标识符,或者是否有人知道正确的语法来声明此 response_model。
第一次编辑
感谢@marcin 让我走上了正确的道路。我知道我需要做什么,但目前我还没有明确地知道如何做。
尝试一次
resource "aws_api_gateway_model" "status_200" {
rest_api_id = aws_api_gateway_rest_api.reconciliation_auth.id
name = "UserConfigResponseModel"
description = "a JSON schema that matches the documented schema here: https://aws.amazon.com/premiumsupport/knowledge-center/transfer-customize-identity-provider/"
content_type = "application/json"
schema = <<EOF
{"$schema":"http://json-schema.org/draft-04/schema#","title":"UserUserConfig","type":"object","properties":{"Role":{"type":"string"},"Policy":{"type":"string"},"HomeDirectory":{"type":"string"},"PublicKeys":{"type":"array","items":{"type":"string"}}}}
EOF
}
resource "aws_api_gateway_method_response" "status_200" {
rest_api_id = aws_api_gateway_rest_api.reconciliation_auth.id
resource_id = aws_api_gateway_resource.config_path.id
http_method = aws_api_gateway_method.config_get.http_method
status_code = "200"
response_models = aws_api_gateway_model.status_200
}
导致
Error: Error creating API Gateway Method Response: BadRequestException: Invalid model identifier specified: {"$schema":"http://json-schema.org/draft-04/schema#","title":"UserUserConfig","type":"object","properties":{"Role":{"type":"string"},"Policy":{"type":"string"},"H
omeDirectory":{"type":"string"},"PublicKeys":{"type":"array","items":{"type":"string"}}}}
on ../../../../module/data-platform-sftp/api_gateway.tf line 65, in resource "aws_api_gateway_method_response" "status_200":
65: resource "aws_api_gateway_method_response" "status_200" {
尝试二
这导致正确的配置
enter image description here
您必须首先使用您提供的 api_gateway_model. The schema
that you need is in the link 创建您的 UserConfigResponseModel
。
Reading this document for how to setup an AWS Transfer Family SFTP server 指定您需要 application/json UserConfigResponseModel
方法响应类型。通过 Web 控制台设置时,这是一种可能的配置
但是当我尝试在 Terraform 中创建相同的配置时,我遇到了
Error: Error creating API Gateway Method Response: BadRequestException: Invalid model identifier specified: UserConfigResponseModel
on ../../../../module/data-platform-sftp/api_gateway.tf line 53, in resource "aws_api_gateway_method_response" "status_200":
53: resource "aws_api_gateway_method_response" "status_200" {
地形声明为
resource "aws_api_gateway_method_response" "status_200" {
rest_api_id = aws_api_gateway_rest_api.reconciliation_auth.id
resource_id = aws_api_gateway_resource.config_path.id
http_method = aws_api_gateway_method.config_get.http_method
status_code = "200"
response_models = {
"application/json" = "UserConfigResponseModel"
}
}
我想知道是否有可能找到所有有效的模型标识符,或者是否有人知道正确的语法来声明此 response_model。
第一次编辑
感谢@marcin 让我走上了正确的道路。我知道我需要做什么,但目前我还没有明确地知道如何做。
尝试一次
resource "aws_api_gateway_model" "status_200" {
rest_api_id = aws_api_gateway_rest_api.reconciliation_auth.id
name = "UserConfigResponseModel"
description = "a JSON schema that matches the documented schema here: https://aws.amazon.com/premiumsupport/knowledge-center/transfer-customize-identity-provider/"
content_type = "application/json"
schema = <<EOF
{"$schema":"http://json-schema.org/draft-04/schema#","title":"UserUserConfig","type":"object","properties":{"Role":{"type":"string"},"Policy":{"type":"string"},"HomeDirectory":{"type":"string"},"PublicKeys":{"type":"array","items":{"type":"string"}}}}
EOF
}
resource "aws_api_gateway_method_response" "status_200" {
rest_api_id = aws_api_gateway_rest_api.reconciliation_auth.id
resource_id = aws_api_gateway_resource.config_path.id
http_method = aws_api_gateway_method.config_get.http_method
status_code = "200"
response_models = aws_api_gateway_model.status_200
}
导致
Error: Error creating API Gateway Method Response: BadRequestException: Invalid model identifier specified: {"$schema":"http://json-schema.org/draft-04/schema#","title":"UserUserConfig","type":"object","properties":{"Role":{"type":"string"},"Policy":{"type":"string"},"H
omeDirectory":{"type":"string"},"PublicKeys":{"type":"array","items":{"type":"string"}}}}
on ../../../../module/data-platform-sftp/api_gateway.tf line 65, in resource "aws_api_gateway_method_response" "status_200":
65: resource "aws_api_gateway_method_response" "status_200" {
尝试二
这导致正确的配置
enter image description here
您必须首先使用您提供的 api_gateway_model. The schema
that you need is in the link 创建您的 UserConfigResponseModel
。