gpt4 book ai didi

amazon-web-services - 模板的资源 block 中 Unresolved 资源依赖性 [RestAPIDeployment]

转载 作者:行者123 更新时间:2023-12-03 07:35:46 24 4
gpt4 key购买 nike

我在模板的资源 block 中收到错误 Unresolved 资源依赖项 [RestAPIDeployment],使用cloudformation创建api网关时请帮忙模板是:

{ "AWSTemplateFormatVersion": "2010-09-09", "Description": "创建用于静态内容/网站托管的 S3 apigateway。", “参数”:{

    "AssetInsightId": {
"Description": "Asset Insight ID",
"Type": "String",
"Default": "206153"
},
"ResourceOwner": {
"Description": "tr:resource-owner",
"Type": "String",
"Default": "###"
},
"EnvironmentType": {
"Description": "tr:environment-type",

"Default": "preprod",
"Type": "String",
"AllowedValues": ["preprod", "prod"],
"ConstraintDescription": "must specify preprod, prod."
}
},
"Resources": {
"APIGateWayRestResourceRestApi": {
"Type": "AWS::ApiGateway::RestApi",
"Properties": {
"Name": "MyAPI",
"Description": "API Gateway rest api with cloud formation"
}
},
"APIGateWayResource": {
"Type": "AWS::ApiGateway::Resource",
"Properties": {
"RestApiId": {
"Ref": "APIGateWayRestResourceRestApi"
},
"ParentId": {
"Fn::GetAtt": ["APIGateWayRestResourceRestApi", "RootResourceId"]
},
"PathPart": "pathpart"
}

},
"APIGatewayPostMethod": {
"Type": "AWS::ApiGateway::Method",
"Properties": {
"AuthorizationType": "NONE",
"HttpMethod": "POST",

"Integration": {
"Type": "MOCK",
"IntegrationHttpMethod": "POST"

},
"MethodResponses": [{
"ResponseModels": {
"application/json": {
"Ref": "PostMethodResponse"
}
},
"statusCode" : 200
}
],

"ResourceId": {
"Ref": "APIGateWayResource"
},

"RestApiId": {
"Ref": "APIGateWayRestResourceRestApi"
}
}
},
"PostMethodResponse": {
"Type": "AWS::ApiGateway::Model",
"Properties": {
"ContentType": "application/json",
"Name": "PostMethodResponse",
"RestApiId": {
"Ref": "APIGateWayRestResourceRestApi"
},
"Schema": {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "PostMethodResponse",
"type": "object",
"properties": {
"Email": {
"type": "string"
}
}
}
}
},

"RestApiDeployment": {
"Type": "AWS::ApiGateway::Deployment",
"Properties": {
"RestApiId": {
"Ref": "APIGateWayRestResourceRestApi"
},
"StageName": "dummy"
}
},

"RestAPIStage": {

"Properties": {
"DeploymentId": {
"Ref": "RestAPIDeployment"
},
"MethodSettings": [{
"DataTraceEnabled": true,
"HttpMethod": "*",
"LoggingLevel": "INFO",
"ResourcePath": "/*"
}
],
"RestApiId": {
"Ref": "APIGateWayRestResourceRestApi"
},
"StageName": "Latest"
},
"Type": "AWS::ApiGateway::Stage"
}
}

}

最佳答案

您正在引用 RestAPIDeployment(使用大写“P”和“I”),但定义 RestApiDeployment(使用小写“P”和“I”)。

使这些保持一致,你就会解决这个问题。

关于amazon-web-services - 模板的资源 block 中 Unresolved 资源依赖性 [RestAPIDeployment],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59195015/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com