【发布时间】:2018-03-10 20:06:02
【问题描述】:
据我了解,如果更新了它所依赖的资源,则应该更新指定了 DependsOn 的资源。我在某些资源中看到了这一点,但它似乎不适用于自定义资源。
我正在使用 APIGateway 并尝试在与阶段相关的资源更新时使用自定义资源来部署阶段。这是因为包含的 AWS::ApiGateway::Stage 和 AWS::ApiGateway::Deployment 在需要部署更新时似乎不能很好地工作。
我有以下模板(为方便参考而截取):
<snip>
pipelineMgrStateMachine:
Type: AWS::StepFunctions::StateMachine
Properties:
<snip>
webhookEndPointMethod:
Type: AWS::ApiGateway::Method
DependsOn: pipelineMgrStateMachine
Properties:
RestApiId: !Ref pipelineMgrGW
ResourceId: !Ref webhookEndPointResource
HttpMethod: POST
AuthorizationType: NONE
Integration:
Type: AWS
IntegrationHttpMethod: POST
Uri: !Sub arn:aws:apigateway:${AWS::Region}:states:action/StartExecution
Credentials: !GetAtt pipelineMgrGWRole.Arn
PassthroughBehavior: WHEN_NO_TEMPLATES
RequestTemplates:
application/json: !Sub |
{
"input": "$util.escapeJavaScript($input.json('$'))",
"name": "$context.requestId",
"stateMachineArn": "${pipelineMgrStateMachine}"
}
IntegrationResponses:
- StatusCode: 200
MethodResponses:
- StatusCode: 200
pipelineMgrStageDeployer:
Type: Custom::pipelineMgrStageDeployer
DependsOn: webhookEndPointMethod
Properties:
ServiceToken: !GetAtt apiGwStageDeployer.Arn
StageName: pipelinemgr
RestApiId: !Ref pipelineMgrGW
<snip>
当我更新pipelineMgrStateMachine 资源时,我看到webhookEndPointMethod 已更新,即使webhookEndPointMethod 中没有任何变化。正如预期的那样。
但是,pipelineMgrStageDeployer 没有更新。当我让pipelineMgrStageDeployer 直接依赖于pipelineMgrStateMachine 时,情况也是如此。
关于为什么自定义资源在更新它所依赖的资源时不更新的任何想法?还有其他可能有用的想法或见解吗?
谢谢, 乔
【问题讨论】:
标签: amazon-web-services amazon-cloudformation